-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Add API method for programmatic markdown export #9876
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
base: main
Are you sure you want to change the base?
Conversation
- Add formatTaskAsMarkdown utility to convert ClineMessage arrays to markdown - Implement getTaskAsMarkdown method in API class to retrieve task content as markdown - Support both current active task and historical tasks by ID - Add comprehensive tests for formatting and API functionality - Update RooCodeAPI interface to include new method - Fix ESLint warnings by wrapping case blocks with curly braces This addresses issue #9858 by providing a programmatic way to access the "Copy as markdown" functionality that was previously only available through the UI.
Review completed. This PR adds a well-implemented Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
|
@roomote I have a question. Before these methods are merged, I want to check to see if they are redundant in the code base. The application has a frontend UI component "Copy as markdown".The method getTaskAsMarkdown seams related to that, but our proposed method isn't used in the current implementation. The question is, how does the current implementation accomplish the functionality of composing the current task to markdown to send to the clipboard? Are we proposing a method that is already accomplished in the codebase via a different technique? Check for redundancy before we proceed. |
Redundancy Analysis CompleteThe PR's Existing Functionality Found
This PR's New Functionality
Key Differences
ConclusionThe PR fills a gap by providing programmatic API access to markdown-formatted task content for external extensions. The existing "Copy as markdown" UI button only copies individual message blocks to clipboard and doesn't provide the same capability. |
This PR attempts to address Issue #9858 by implementing an API method that provides programmatic access to the "Copy as markdown" functionality.
Summary
This implementation adds a new
getTaskAsMarkdownAPI method that allows external extensions to programmatically retrieve task content formatted as markdown, similar to the existing UI "Copy as markdown" feature.Implementation Details
The solution follows the established patterns in the Roo Code codebase for API methods and UI-backend communication:
getTaskAsMarkdownto the main API class (src/extension/api.ts)formatTaskAsMarkdown(src/core/task/formatTaskAsMarkdown.ts) that convertsClineMessagearrays to markdownRooCodeAPIinterface inpackages/types/src/api.tsreadTaskMessagesfunctionKey Features
undefinedwhen no task is found or task has no messagesTesting
formatTaskAsMarkdownutility (19 test cases)getTaskAsMarkdownAPI method (8 test cases)Architecture Considerations
This implementation represents an internal "middleware" approach as suggested in the issue comment:
Feedback and guidance are welcome!