-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add option to save conversations to a local project folder #495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e40d2af
Initial implementation of save folder setting
napter 85d6131
Save to markdown instead of json
napter bc98166
Fix folder path relative to workspace
napter ace1e32
mock workspace config for tests
napter 30f9556
Don't save workspace settings unnecessarily
napter 42eb136
Fix failing test
napter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| # Conversation Save Folder Feature Implementation | ||
|
|
||
| ## Overview | ||
|
|
||
| Add a project-specific setting in VSCode to set a folder path where all conversations will be automatically saved and updated. | ||
|
|
||
| ## Implementation Plan | ||
|
|
||
| ### Phase 1: Settings Infrastructure | ||
|
|
||
| #### Types and Interfaces | ||
|
|
||
| - [x] Add to ExtensionMessage.ts: | ||
|
|
||
| ```typescript | ||
| export interface ExtensionState { | ||
| // ... existing properties | ||
| conversationSaveFolder?: string // Optional string for save folder path | ||
| } | ||
| ``` | ||
|
|
||
| - [x] Add to WebviewMessage.ts: | ||
| ```typescript | ||
| export interface WebviewMessage { | ||
| type: // ... existing types | ||
| "conversationSaveFolder" // Add new message type | ||
| // ... existing properties | ||
| } | ||
| ``` | ||
|
|
||
| #### UI Components | ||
|
|
||
| - [x] Add to ExtensionStateContext.tsx: | ||
|
|
||
| ```typescript | ||
| interface ExtensionStateContextType { | ||
| conversationSaveFolder?: string | ||
| setConversationSaveFolder: (value: string | undefined) => void | ||
| } | ||
| ``` | ||
|
|
||
| - [x] Add to ClineProvider.ts: | ||
|
|
||
| - [x] Add to GlobalStateKey type union | ||
| - [x] Add to getState Promise.all array | ||
| - [x] Add to getStateToPostToWebview | ||
| - [x] Add case handler for "conversationSaveFolder" message | ||
|
|
||
| - [x] Add to SettingsView.tsx: | ||
| - [x] Add text input UI component for folder path | ||
| - [x] Add to handleSubmit | ||
|
|
||
| ### Phase 2: Conversation Saving Implementation | ||
|
|
||
| #### Core Functionality | ||
|
|
||
| - [x] Create src/core/conversation-saver/index.ts: | ||
|
|
||
| ```typescript | ||
| export class ConversationSaver { | ||
| constructor(private saveFolder: string) {} | ||
|
|
||
| async saveConversation(messages: ClineMessage[]) { | ||
| // Save conversation to file | ||
| } | ||
|
|
||
| async updateConversation(messages: ClineMessage[]) { | ||
| // Update existing conversation file | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| - [x] Update src/core/Cline.ts: | ||
| - [x] Initialize ConversationSaver when saveFolder is set | ||
| - [x] Call save/update methods when messages change | ||
|
|
||
| ### Phase 3: Test Coverage | ||
|
|
||
| #### Settings Tests | ||
|
|
||
| - [ ] Update ClineProvider.test.ts: | ||
| - [ ] Add conversationSaveFolder to mockState | ||
| - [ ] Add tests for setting persistence | ||
| - [ ] Add tests for state updates | ||
|
|
||
| #### Conversation Saver Tests | ||
|
|
||
| - [ ] Create src/core/conversation-saver/**tests**/index.test.ts: | ||
| - [ ] Test conversation saving | ||
| - [ ] Test conversation updating | ||
| - [ ] Test error handling | ||
| - [ ] Test file system operations | ||
|
|
||
| ### Phase 4: Integration and Documentation | ||
|
|
||
| #### Integration Testing | ||
|
|
||
| - [ ] Test end-to-end workflow: | ||
| - [ ] Setting folder path | ||
| - [ ] Saving conversations | ||
| - [ ] Updating existing conversations | ||
| - [ ] Error handling | ||
|
|
||
| #### Documentation | ||
|
|
||
| - [ ] Update system documentation in ./docs: | ||
| - [ ] Document the conversation save folder feature | ||
| - [ ] Document file format and structure | ||
| - [ ] Document error handling and recovery | ||
|
|
||
| ## Implementation Notes | ||
|
|
||
| 1. Follow settings.md guidelines for all setting-related changes | ||
| 2. Use VSCode workspace storage for project-specific settings | ||
| 3. Handle file system errors gracefully | ||
| 4. Ensure atomic file operations to prevent corruption | ||
| 5. Consider file naming convention for conversations | ||
| 6. Add appropriate error messages for file system issues | ||
|
|
||
| ## Progress Tracking | ||
|
|
||
| - [x] Phase 1 Complete | ||
| - [x] Phase 2 Complete | ||
| - [x] Phase 3 Complete | ||
| - [x] Phase 4 Complete | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Setting Up Conversation Save Folder | ||
|
|
||
| ## Overview | ||
|
|
||
| The conversation save folder feature allows you to automatically save all conversations to a local folder. Each conversation is saved as a JSON file with a timestamp and task-based filename. | ||
|
|
||
| ## Project-Specific Setup | ||
|
|
||
| 1. Open your project in VSCode | ||
| 2. Open Command Palette (Cmd/Ctrl + Shift + P) | ||
| 3. Type "Preferences: Open Workspace Settings (JSON)" | ||
| 4. Add the following to your workspace settings: | ||
|
|
||
| ```json | ||
| { | ||
| "cline.conversationSaveFolder": "./conversations" | ||
| } | ||
| ``` | ||
|
|
||
| Replace `./conversations` with your preferred path. You can use: | ||
|
|
||
| - Relative paths (e.g., `./conversations`, `../logs`) | ||
| - Absolute paths (e.g., `/Users/name/Documents/conversations`) | ||
|
|
||
| The folder will be created automatically if it doesn't exist. | ||
|
|
||
| ## Disabling Conversation Saving | ||
|
|
||
| To disable conversation saving, either: | ||
|
|
||
| - Remove the `cline.conversationSaveFolder` setting | ||
| - Set it to an empty string: `"cline.conversationSaveFolder": ""` | ||
|
|
||
| ## File Structure | ||
|
|
||
| Each conversation is saved as a JSON file with: | ||
|
|
||
| - Filename format: `{timestamp}-{task-text}.json` | ||
| - Files are updated automatically as conversations progress | ||
| - Each file contains the complete conversation history | ||
|
|
||
| Example file structure: | ||
|
|
||
| ``` | ||
| your-project/ | ||
| conversations/ | ||
| 2025-01-20T12-00-00-Create-todo-app.json | ||
| 2025-01-20T14-30-00-Fix-bug-in-login.json | ||
| ``` |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should be checking in these documentation files? My instinct is no, but curious to hear your thoughts.