feat(cli): switch default draft format to JSON with --markdown option#377
feat(cli): switch default draft format to JSON with --markdown option#377
Conversation
Changes the draft create command to output JSON by default (matching the desktop app format), while adding a --markdown flag for users who prefer raw markdown. This unifies the draft format between CLI and desktop. - Default draft format now uses JSON with editor content structure - New --markdown flag preserves raw markdown (legacy format) - Filename scheme: <nanoid>.json for JSON, <slug>_<nanoid>.md for markdown - Added blocks field to readInput() in document.ts to support conversions - Updated draft rm to handle both .md and .json files - Comprehensive test suite updates for new JSON format handling
|
What's reason behind changing the default draft format in the cli? Right now everything we produce with the cli is markdown first, since it's llm's format of choice. Also, markdown can be further ammended and updated manually by the user. Or even created by the user entirely. The drawback is that markdown is not as rich as json so not all block types can be represented in .MD files unless we do nastier things with html tagging. But the cli currently only supports basic blocks. So I wonder if you plan to add more blocks to the cli or what was the purpose |
|
I agree that the JSON is a better format for saving. But the markdown CLI behavior by default is part of our design principles |
💯 Yeah, the problem is, how do reconcile those two? Right now the cli saves it in .md AND also writes the index json so that the app can see this too (internally the desktop app parses it using the parser in the client SDK). The desktop app still saves them in json because only the desktop app can generate rich documents only supported by json format |
|
@juligasa the problem is that now If I create a draft with the CLI and I want to open it in the app, its not possible. the screen gets blank when I click the draft in the drafts list. I guess the solution here is either store the file in both formats, or store the markdown file in another place. and I believe a CLI should store file where they are runned, or you can pass an output flag or something. What we can't have is what we have currently, that we are storing markdown files in the drafts folder. because drafts made in the app are not stored in markdown. |
|
I'm not sure its a good idea for the CLI to work with the same drafts folder as the desktop app. Helpful for us I think, but I think its generally a bad practice to use the same signing keys and drafts between CLI and desktop because usually the desktop is operated by a human and the CLI is operated by a bot or a script, who should have a different identity. I guess it would be good to use the same draft saving format and code. Then maybe there is a CLI flag which allows you to specify the drafts folder, in case the user really does want to use the same one as desktop. |
|
yes, this is exactly what I was proposing in the previous comment:
wdyt @juligasa ? |
|
I don't agree that the CLI should have two formats of draft saving. What is the benefit of saving the drafts as markdown? I believe that the CLI should output markdown to the user (following our design principle), but it can use the "proper" data format underneath. I am not sure about using the CWD for drafts. Maybe it is the best option, and the user will reference drafts via path name. Or maybe the CLI should choose a location for the user's drafts, something like |
|
Actually we currently accept a path override via flag. But the default path is the seed path. I wanted to have a global place for drafts since i did not want drafts scattered among directories depending on where you invoked the cli from. |
…esktop app CLI-created drafts without --edit/--location flags lacked editUid and locationUid, causing drafts.write to reject auto-saves and the draft state machine to get stuck — rendering a blank screen. - Relax HMDraftMeta type to allow neither editUid nor locationUid - Remove drafts.write guard requiring editUid/locationUid (only needed at publish time, where the UI already handles it) - Fix draft state machine onError to recover to idle instead of getting stuck in creating/saving state - Fix discoverNewDrafts() to merge CLI-written index.json entries before scanning, preserving CLI-set metadata Ref #377
|
I believe the major benefit of Seed with agents is that we can use changes to track attribution between agent and human. So, when the agent completes their change, it gets signed (no longer in draft mode). Then when the human makes improvements on the agent's work, you can see exactly what was changed. Of course I should be able to see that an agent was "steered" by a certain human, and ideally I would also see the prompts that were used to create the agents output. So that way I can see how the humans on my team are using AI. In 2026 hate wondering "is this team member really thinking this way, or is this just a LLM hallucination" And, I think that if you really do want to use your personal keys to sign LLM-generated content, that should be possible (but discouraged with the default UX) |
the error is that the desktop app tries to open a file that it does not know how to handle or interact with (markdown). |
It does know hoe to handle it, there was a bug, I already pushed the fix. The Desktop app should now see the drafts created by the CLI. Is still failing for you @horacioh ?
Then, to what extend drafts in the CLI are useful? because there are two conflicting flows.
The thing is, in case 1, we should instruct (via skill) the llm to create a draft instead of a document while the opposite is true for case 2. |
|
@juligasa this is the error I get when I try to edit the draft created by the CLI This is because we need to add I confirm I can open drafts created by the CLI! |
I know. The fix was supposed to handle that. You just needed to pull the code and open the drafts again |

Summary
--markdownflag: Users can opt into the legacy Markdown format with--markdownoption<nanoid>.jsoninstead of<slug>_<nanoid>.mdfor consistency with desktopdraft rm --allnow properly handles both.mdand.jsondraft files--markdownoptionBreaking Changes
draft createnow outputs JSON format by default instead of Markdown. Users who need Markdown format must pass the--markdownflag.<slug>_<nanoid>.mdto<nanoid>.jsonfor JSON drafts.