dcdpr / dcdpr/jp

Edit conversation details/content in your `$EDITOR`

Open
#8 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
16
Forks
3
Avg merge
1d 1h
Merged PRs (30d)
121

Description

We currently have jp conversation edit:

Edit conversation details

Usage: jp conversation edit [OPTIONS] <ID|--private [<PRIVATE>]|--title [<TITLE>]|--no-title>

Arguments:
  [ID]  Conversation ID to edit. Defaults to active conversation

Options:
      --local [<LOCAL>]  Toggle the conversation between local and workspace-scoped [possible values: true, false]
      --title [<TITLE>]      Edit the title of the conversation
      --no-title             Remove the title of the conversation

This allows editing the conversation title, or storing the conversation locally or in the workspace.

We should also allow editing the actual content of the conversation. This would allow modifying any content or metadata of the conversation.

I propose the following workflow:

  • jp conversation edit [ID] without any flags opens your $EDITOR

  • Before opening the editor, we create a temporary file with the conversation history in markdown

  • We also add conversation metadata (such as local flag, conversation title, etc.) as frontmatter to the markdown file, to allow editing conversation metadata.

  • In the editor, we open this temporary file

  • The contents of the file could look like this:

    ---
    title: Check check, is this thing on?
    local: false
    ---
    
    # Assistant
    How can I help you?
    
    # User
    Ah great!
    
    # Assistant
    Yes, I am here!
    
    # User
    Is this thing on?
    
  • Note that the history is shown in reverse order, so the last assistant reply is shown at the top, since that is where your cursor will be when the editor opens.

  • When saving and exiting the editor, we parse the modified markdown.

    • This is important, because LLM providers expect certain "flows" in conversations, the most basic requirement is that the conversation starts with a user query. JP also expects a conversation to consist of "message pairs" (query + answer).
    • If parsing fails, we return a (detailed) error, but do not remove the file, so jp conversation edit re-opens the file in its last state, so the user can fix any issues.
    • If parsing succeeds, we serialize the modified conversation to disk and remove the temporary file.

This makes it easy to modify everything about a conversation in your favourite tool/editor.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the jp conversation edit command and review its existing title and local/workspace editing behavior. Then trace how conversation history is serialized and identify the entry points for opening $EDITOR, parsing Markdown with frontmatter, validating message pairs, and persisting the result. Done means valid edits are saved and the temporary file remains available after a detailed parse failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.