feat: Add "Copy for AI" button to package page#169
feat: Add "Copy for AI" button to package page#169NormVg wants to merge 2 commits intonpmx-dev:mainfrom
Conversation
- Adds button to copy package info (name, version, description, install command, README) as markdown for AI context - Button positioned right of description on desktop, hidden on mobile - Secondary button in README section for mobile access - Uses theme-consistent btn/btn-ghost shortcuts - Fixed width (min-w-32) to prevent size change on copy feedback
|
@NormVg is attempting to deploy a commit to the danielroe Team on Vercel. A member of the Team first needs to authorize it. |
|
this is related to #151 - we should probably have a shared util that we can use both for rendering a package to markdown from the server, and also for copying. |
|
hm. why don't I merge that one first and then you can refactor to share code as needed? I haven't checked - you might also have some improvements on the markdown rendering |
sure lets me know to improve and update , would love to |
|
hey @NormVg this gotten quite stale and |
feat: Add "Copy for AI" button to package page
Summary
Adds a "Copy for AI" button that copies package information formatted as markdown, optimized for pasting into AI assistants (Claude, ChatGPT, etc.).
Files Changed
app/pages/[...package].vueSingle file modification with ~117 insertions, ~28 deletions.
Implementation Details
1. State Management (Script Section)
2. README Text Extraction
Since
SlimPackumentdoesn't include raw README markdown (fetched separately as HTML), the implementation extracts text content client-side:3. Primary Button (Desktop Only)
Located right of the package description:
btnshortcut from design systemhidden sm:inline-flex- hidden on mobile, visible on ≥640pxmin-w-32- fixed width prevents size change on text toggle4. Secondary Button (README Section)
Located next to "Readme" heading:
btn-ghostshortcut (more subtle)5. Responsive Layout
Description container updated for responsive behavior:
flex-colon mobile (stacked)sm:flex-rowon desktop (side-by-side)What Gets Copied
No New Routes/APIs
This feature is entirely client-side. No new API endpoints or routes were created. Uses existing:
usePackage()composable for package datareadmeDatafrom existing README fetchnavigator.clipboard.writeText()APIChecklist
btn,btn-ghost)<ClientOnly>to prevent SSR issues