feat(cli): export and import sessions#11075
Open
uinstinct wants to merge 2 commits intocontinuedev:mainfrom
Open
feat(cli): export and import sessions#11075uinstinct wants to merge 2 commits intocontinuedev:mainfrom
uinstinct wants to merge 2 commits intocontinuedev:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
3 issues found across 8 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="extensions/cli/src/slashCommands.ts">
<violation number="1" location="extensions/cli/src/slashCommands.ts:199">
P2: `/import` only uses `args[0]`, so file paths containing spaces are truncated and reported as missing.</violation>
<violation number="2" location="extensions/cli/src/slashCommands.ts:218">
P2: Import command lacks runtime validation of exported session format/version before persistence, allowing incompatible or malformed session data to be saved.</violation>
<violation number="3" location="extensions/cli/src/slashCommands.ts:222">
P1: Import collision detection only checks 1000 sessions, so duplicate IDs outside that window can be missed and existing sessions overwritten.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
|
||
| let session = exportedData.session; | ||
|
|
||
| const existingSessions = historyManager.list({ limit: 1000 }); |
Contributor
There was a problem hiding this comment.
P1: Import collision detection only checks 1000 sessions, so duplicate IDs outside that window can be missed and existing sessions overwritten.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At extensions/cli/src/slashCommands.ts, line 222:
<comment>Import collision detection only checks 1000 sessions, so duplicate IDs outside that window can be missed and existing sessions overwritten.</comment>
<file context>
@@ -173,6 +178,83 @@ function handleJobs() {
+
+ let session = exportedData.session;
+
+ const existingSessions = historyManager.list({ limit: 1000 });
+ const sessionExists = existingSessions.some(
+ (s) => s.sessionId === session.sessionId,
</file context>
Suggested change
| const existingSessions = historyManager.list({ limit: 1000 }); | |
| const existingSessions = historyManager.list({}); |
| function handleImport(args: string[]): SlashCommandResult { | ||
| posthogService.capture("useSlashCommand", { name: "import" }); | ||
|
|
||
| const filePath = args[0]; |
Contributor
There was a problem hiding this comment.
P2: /import only uses args[0], so file paths containing spaces are truncated and reported as missing.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At extensions/cli/src/slashCommands.ts, line 199:
<comment>`/import` only uses `args[0]`, so file paths containing spaces are truncated and reported as missing.</comment>
<file context>
@@ -173,6 +178,83 @@ function handleJobs() {
+function handleImport(args: string[]): SlashCommandResult {
+ posthogService.capture("useSlashCommand", { name: "import" });
+
+ const filePath = args[0];
+ if (!filePath) {
+ return {
</file context>
Suggested change
| const filePath = args[0]; | |
| const filePath = args.join(" ").trim().replace(/^['\"]|['\"]$/g, ""); |
|
|
||
| try { | ||
| const fileContent = fs.readFileSync(filePath, "utf-8"); | ||
| const exportedData: ExportedSession = JSON.parse(fileContent); |
Contributor
There was a problem hiding this comment.
P2: Import command lacks runtime validation of exported session format/version before persistence, allowing incompatible or malformed session data to be saved.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At extensions/cli/src/slashCommands.ts, line 218:
<comment>Import command lacks runtime validation of exported session format/version before persistence, allowing incompatible or malformed session data to be saved.</comment>
<file context>
@@ -173,6 +178,83 @@ function handleJobs() {
+
+ try {
+ const fileContent = fs.readFileSync(filePath, "utf-8");
+ const exportedData: ExportedSession = JSON.parse(fileContent);
+
+ let session = exportedData.session;
</file context>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add the ability to export a selected session and import it by path of the file.
AI Code Review
@continue-reviewChecklist
Screen recording or screenshot
[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See this PR as a good example. ]
Tests
[ What tests were added or updated to ensure the changes work as expected? ]
Continue Tasks: 🔄 7 running — View all
Summary by cubic
Add CLI support to export a session to JSON and import a session from a file path. Adds new slash commands and a TUI export selector to make moving sessions easy.
Written for commit 026a449. Summary will update on new commits.