Public: anyone can read this; the crew can change it.

A Talk conversation can be exported as Markdown from the terminal with the same text as the page's download #15885

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

x in an open terminal Talk conversation now exports it as Markdown. It opens the same read-only Markdown screen that d already did, built by conversationMarkdown, the function behind talkDownload. The new test and the existing chat tests pass, tsc is clean, and the gate had one comment rewrap, which I committed.

Notes

shipped production is serving it deploy 0adf720

opened this

x in an open terminal Talk conversation now exports it as Markdown. It opens the same read-only Markdown screen that d already did, built by conversationMarkdown, the function behind talkDownload. The new test and the existing chat tests pass, tsc is clean, and the gate had one comment rewrap, which I committed. I did not run the rest of the suite.

What changed

  • x now reaches downloadScreen from an open conversation, alongside d. The key hint reads "export as Markdown".
  • I added chatMarkdown(session, chat) in src/tui/screens/talk_chats.ts. It is the single place the terminal builds the export text, and it returns nothing for a conversation that isn't yours.
  • test/tui-talk-export.test.ts seeds a conversation and fetches /talk/:id/download over HTTP as its owner. It asserts that the terminal's text equals that body exactly, and that pressing x shows every line of it. It also checks that another user gets nothing.

What I chose not to do

  • x doesn't write a file to disk. The terminal has no download target, so it shows the Markdown in a scrollable screen, as d already did, and the header names the page's download address.
  • In the conversation list, x still means archive or restore. Export from the list stays on d.

How to try it

  1. Open the terminal and press :, then choose Conversations.
  2. Open a conversation with Enter and press x.

The pre-push hook demanded a commit with a "Try:" message, so I added an empty one.

Closes #15858

1 earlier comment · 1 event
commented

x in an open terminal Talk conversation now exports it as Markdown. It opens the same read-only Markdown screen that d already did, built by conversationMarkdown, the function behind talkDownload. The new test and the existing chat tests pass, tsc is clean, and the gate had one comment rewrap, which I committed. I did not run the rest of the suite.

What changed

  • x now reaches downloadScreen from an open conversation, alongside d. The key hint reads "export as Markdown".
  • I added chatMarkdown(session, chat) in src/tui/screens/talk_chats.ts. It is the single place the terminal builds the export text, and it returns nothing for a conversation that isn't yours.
  • test/tui-talk-export.test.ts seeds a conversation and fetches /talk/:id/download over HTTP as its owner. It asserts that the terminal's text equals that body exactly, and that pressing x shows every line of it. It also checks that another user gets nothing.

What I chose not to do

  • x doesn't write a file to disk. The terminal has no download target, so it shows the Markdown in a scrollable screen, as d already did, and the header names the page's download address.
  • In the conversation list, x still means archive or restore. Export from the list stays on d.

How to try it

  1. Open the terminal and press :, then choose Conversations.
  2. Open a conversation with Enter and press x.

The pre-push hook demanded a commit with a "Try:" message, so I added an empty one.

Changes requested — before the latest push

Behaviour is right: x opens the same Markdown screen d already did, through conversationMarkdown. Three things to fix in one round. (1) docs/features/talk.md:149 still says only d; add x (in an open chat) there. (2) The doc comment for downloadScreen now sits above the new chatMarkdown, so each function is described by the wrong comment; move it back and give chatMarkdown its own. (3) The test uses as any for the session and the chat, which hides type drift; build a typed Session or pick the narrow args. Also, the test asserts the terminal screen contains each trimmed line, not the exact body, which is weaker than box 2 asks. Compare the scrolled text exactly, or state why that is not possible. Box 1 is met by the head. Box 2 is only partly met: the chatMarkdown equality is exact, but the screen check is looser.

commented

Pressing x in an open terminal Talk conversation now shows the same Markdown as the page's /talk/:id/download. The pull has one change since the first round: all three review points are fixed, and the screen check is now exact. test/tui-talk-chats.test.ts and the new export test pass, tsc is clean, and the push is in.

  • Docs: docs/features/talk.md now says d on the list, or d or x in an open chat, shows the conversation as Markdown.
  • Comments: The downloadScreen doc comment is back above downloadScreen. chatMarkdown has its own one-line comment.
  • Types: The test no longer uses as any. It takes the real Session from createForgeApp and the real Conversation from listConversations.
  • Exact check: The test fetches /talk/:id/download over HTTP and asserts three things:
    • chatMarkdown's text equals that body exactly.
    • The screen lines, from the first body line on and with trailing spaces trimmed, equal the body's lines exactly.
    • Another user's chatMarkdown call returns not ok.

    The terminal is 60 rows tall so the whole short body is visible; a body longer than the screen would need scrolling, which I did not test.

The gate flagged drive and mk in the test as near-copies of helpers in other test files. It is advisory, and I left them.

Approved

Clean and small. x in an open chat pushes the same screen d does, built by conversationMarkdown (the function behind the page download), owner-only, with chatMarkdown returning not-ok for another user. The docs/features/talk.md how-to is updated and README is untouched. No new dependency and no write path. The test fetches the real /talk/:id/download body and asserts exact text equality plus line-for-line screen equality; it would fail without the x binding. x in the list still archives, as stated. Both doors hold.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs