Skip to content

feat: CSV and Markdown export for the Prompts route - #10

Open
sebastientang wants to merge 1 commit into
nateherkai:mainfrom
sebastientang:pr/drill-export
Open

feat: CSV and Markdown export for the Prompts route#10
sebastientang wants to merge 1 commit into
nateherkai:mainfrom
sebastientang:pr/drill-export

Conversation

@sebastientang

Copy link
Copy Markdown

Closes upstream's "CSV or JSON export of any route" wishlist item from CONTRIBUTING.md.

What this adds

  • web/export.js (new, 60 lines) — four small helpers:
    • toCSV(sections) — RFC-4180-style escaping (quotes, commas, newlines)
    • toMarkdown(title, sections) — pipe-and-newline-safe GFM tables
    • copyToClipboard(text) — async, returns true/false so the caller can show feedback
    • downloadBlob(filename, mime, text) — anchor-based download with URL.revokeObjectURL cleanup
  • Prompts route header — adds Copy MD and Download CSV buttons next to the existing sort tabs. Copy MD shows transient "Copied!" feedback. Download CSV exports the currently sorted set with the file name prompts-<sort>-<YYYY-MM-DD>.csv.

The helpers operate on a sections payload ([{ heading, columns, rows }]) so the same shape can be reused later for sessions / projects / skills exports without touching export.js.

Why prompts first

Prompts are the route most useful to take into a spreadsheet — full text, model, tokens, cost, session. Other routes can follow in subsequent PRs once the helper shape is reviewed.

Tests

JS-only utility code with manual smoke testing against the running dashboard:

python3 cli.py dashboard --no-open
# Open #/prompts → click Download CSV → opens with quoted prompt text
# Click Copy MD → "Copied!" feedback → paste into a markdown editor

The repo doesn't ship a JS test runner, so I didn't add one. Happy to add a Python integration test that hits /api/prompts and asserts the JSON shape web/export.js consumes, if there's a preferred shape.

Closes upstreams CSV/JSON export wishlist item. Adds web/export.js with
four small helpers (toCSV, toMarkdown, copyToClipboard, downloadBlob)
and wires Copy MD / Download CSV buttons into the Prompts route header.

The helpers operate on a sections payload — the same shape can be
reused for any future per-route or per-drawer export. CSV preserves the
full prompt text via standard quoting; MD truncates pipes/newlines for
clean GFM rendering.

No new Python tests — this is JS-only utility code with manual smoke-
test against the running dashboard.
muckybuzzwoo added a commit to muckybuzzwoo/token-dashboard that referenced this pull request May 13, 2026
muckybuzzwoo added a commit to muckybuzzwoo/token-dashboard that referenced this pull request May 22, 2026
- README clone URL now points at the fork (was upstream).
- "The 7 tabs" → "The 8 tabs" — adds RTK and updates the Skills entry
  to describe the new "You ran" / "Claude invoked" split. Settings
  section mentions Team plans (PR nateherkai#15) and runtime .claude-folder
  switching (PR nateherkai#7).
- First-run scan-time estimate dropped from 20–60s to 5–10s to
  reflect the PR nateherkai#18 batched-insert scanner. Prompts entry now
  mentions the CSV / Markdown export (PR nateherkai#10).
- FORK_NOTES.md gains a "Last updated" line at the top pointing at
  the commits page as the running change log.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant