feat: Add "Copy for AI" button to package page #169
+117
−28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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