Commit cef0d2b
authored
feat(docs): add Copy Prompt button for AI assistants (#1706)
## What
Adds a reusable **Copy Prompt** button to the Vite+ docs. It copies a
ready-made, AI-friendly getting-started prompt to the clipboard so users
can hand it straight to their coding agent.
The prompt introduces Vite+, points the agent at
`https://viteplus.dev/llms-full.txt`, gives the platform-specific
install commands, and lists the core `vp` commands.
## Where it appears
- **Front page** — in the hero CTA row, beside *Get started* / *Read the
Announcement* (`docs/.vitepress/theme/components/home/Hero.vue`). The
row is now `flex-wrap` so three buttons don't overflow on narrow
screens.
- **Getting Started** — right after the intro paragraph
(`docs/guide/index.md`).
## Implementation
- New `docs/.vitepress/theme/components/CopyPrompt.vue` — a single
themed `.button` with `prompt` / `label` props (defaults to a shared
`DEFAULT_PROMPT` and `"Copy Prompt"`). Clipboard + flash-feedback logic
models the existing `InstallCommand.vue`; shows **Copied!** on success
and **Could not copy** on failure.
- Registered globally via `enhanceApp` in
`docs/.vitepress/theme/index.ts` so any Markdown page can use
`<CopyPrompt />` without an import.
- Pointer clicks drop focus so the theme's `outline`-based `.button`
border isn't stripped by the global `button:focus:not(:focus-visible) {
outline: none !important }` reset — that reset only bites real
`<button>` elements, since the theme otherwise uses `.button` on `<a>`
tags. Keyboard activation keeps focus so the a11y focus ring still
shows.
Scope: main `docs/` site only; the duplicate `packages/cli/docs/` guide
tree is intentionally left unchanged.
## Verification
- `cd docs && pnpm build` — clean production build; the button renders
into both `index.html` and `guide/index.html`, and the prompt is
bundled.
- Previewed in `pnpm dev`: button reads **Copy Prompt**, flashes
**Copied!**, and keeps its border through the click on both pages.
- Fact-checked the copied prompt end-to-end: both install URLs resolve
to the real installers, `llms-full.txt` is live and documents every
command named, and a fresh `vp create → install → check → dev → build`
workflow all succeed. (`vp test` exits non-zero only because a bare
scaffold has no test files yet — expected Vitest behavior.)
🤖 Generated with [Claude Code](https://claude.com/claude-code)1 parent d195acf commit cef0d2b
4 files changed
Lines changed: 107 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
12 | 17 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
| |||
0 commit comments