@iamdangavin/claude-skill-vitepress-docs 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/vitedocs/brand.md +158 -0
- package/commands/vitedocs/generate.md +626 -0
- package/commands/vitedocs/init.md +3 -1323
- package/commands/vitedocs/screenshot.md +126 -0
- package/commands/vitedocs/setup.md +277 -0
- package/commands/vitedocs/sync.md +97 -0
- package/commands/vitedocs/update.md +142 -0
- package/package.json +1 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vitedocs:screenshot
|
|
3
|
+
description: Capture real screenshots using Playwright and replace placeholders in docs.
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Write
|
|
7
|
+
- Edit
|
|
8
|
+
- Bash
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- AskUserQuestion
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
This mode reads `.vitepress/docs-manifest.json`. Run `/vitedocs:generate` first if no manifest exists yet.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Mode: screenshot
|
|
19
|
+
|
|
20
|
+
### Step 1 — Gather capture details
|
|
21
|
+
|
|
22
|
+
**Q1 — Source:**
|
|
23
|
+
- header: "Capture source"
|
|
24
|
+
- question: "Where should I capture screenshots from?"
|
|
25
|
+
- options:
|
|
26
|
+
- "Local dev server — I'll capture from a running server"
|
|
27
|
+
- "Deployed URL — give me the base URL"
|
|
28
|
+
|
|
29
|
+
If deployed: ask as plain text — "What is the base URL? (e.g. `https://docs.myapp.com`)"
|
|
30
|
+
|
|
31
|
+
**Q2 — Stack type** (only if local):
|
|
32
|
+
- header: "Project type"
|
|
33
|
+
- question: "What type of project is this?"
|
|
34
|
+
- options:
|
|
35
|
+
- "Node/npm — you can optionally start the server for me"
|
|
36
|
+
- "WordPress, PHP, or other non-Node stack"
|
|
37
|
+
- "Static files"
|
|
38
|
+
|
|
39
|
+
**Q3 — Server status** (only if local Node):
|
|
40
|
+
- header: "Dev server"
|
|
41
|
+
- question: "Is the dev server already running?"
|
|
42
|
+
- options:
|
|
43
|
+
- "Already running"
|
|
44
|
+
- "Not running — please start it for me"
|
|
45
|
+
|
|
46
|
+
If starting: ask as plain text — "What command starts it? And what URL/port does it run on?"
|
|
47
|
+
|
|
48
|
+
**Q4 — Authentication:**
|
|
49
|
+
- header: "Login required?"
|
|
50
|
+
- question: "Does reaching the screens that need screenshots require login?"
|
|
51
|
+
- options:
|
|
52
|
+
- "No — all target screens are public"
|
|
53
|
+
- "Yes — I'll provide credentials"
|
|
54
|
+
|
|
55
|
+
If yes: ask as plain text — "Please provide the username and password. ⚠️ Credentials are used only to drive the browser in this session — they will NEVER be written to any file, the manifest, or anywhere outside this conversation."
|
|
56
|
+
|
|
57
|
+
**Q5 — Scope:**
|
|
58
|
+
- header: "Capture scope"
|
|
59
|
+
- question: "Which screenshots should I capture?"
|
|
60
|
+
- options:
|
|
61
|
+
- "All placeholders from the manifest"
|
|
62
|
+
- "Specific pages only — I'll tell you which"
|
|
63
|
+
|
|
64
|
+
If specific: ask as plain text — "Which pages or screenshots?"
|
|
65
|
+
|
|
66
|
+
Wait for all answers.
|
|
67
|
+
|
|
68
|
+
### Step 2 — Find all placeholders
|
|
69
|
+
|
|
70
|
+
Read `.vitepress/docs-manifest.json`. Filter to all images where `"placeholder": true`. Group by the doc page they belong to.
|
|
71
|
+
|
|
72
|
+
If no manifest exists, scan all markdown files in the docs folder for images referencing `public/screenshots/` — treat all of them as needing capture.
|
|
73
|
+
|
|
74
|
+
### Step 3 — Capture screenshots
|
|
75
|
+
|
|
76
|
+
For each placeholder, refer to the manifest's `captureUrl` and `captureNote` fields to understand what state to capture.
|
|
77
|
+
|
|
78
|
+
Use Playwright via Homebrew for all captures:
|
|
79
|
+
```js
|
|
80
|
+
import { chromium } from '/opt/homebrew/lib/node_modules/playwright/index.mjs';
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**⛔ Credential rule — NEVER write credentials to any file.** Do not write them to a script file, `.env`, the manifest, or anywhere on disk. All Playwright scripts run as inline bash heredocs — credentials are passed directly as inline values to `page.fill()` calls within the heredoc and exist only in memory for the duration of the command. If Playwright needs credentials in a reusable way, use a saved storage state file — but prompt the user for credentials fresh each time rather than caching them.
|
|
84
|
+
|
|
85
|
+
**For pages requiring auth:** if credentials were provided, drive a login flow before navigating to the target URL. If no credentials were given, skip auth-gated pages and list them in the final summary so the user can run `/vitedocs:screenshot` again with credentials.
|
|
86
|
+
|
|
87
|
+
**Standard capture script template:**
|
|
88
|
+
|
|
89
|
+
Run inline via bash heredoc — no file is ever written to disk:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
node --input-type=module << 'SCRIPT'
|
|
93
|
+
import { chromium } from '/opt/homebrew/lib/node_modules/playwright/index.mjs';
|
|
94
|
+
const browser = await chromium.launch({ channel: 'chrome', args: ['--no-sandbox'] });
|
|
95
|
+
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
|
|
96
|
+
await page.goto('BASE_URL + captureUrl', { waitUntil: 'load', timeout: 60000 });
|
|
97
|
+
await page.waitForTimeout(SETTLE_MS);
|
|
98
|
+
await page.screenshot({ path: 'OUTPUT_PATH', fullPage: false });
|
|
99
|
+
await browser.close();
|
|
100
|
+
SCRIPT
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Adjust `SETTLE_MS` based on stack type: WordPress/non-SPA → `500`, Next.js/SPA → `2000`–`4000`.
|
|
104
|
+
|
|
105
|
+
Never write the script to a file — always use the heredoc form above.
|
|
106
|
+
|
|
107
|
+
### Step 4 — Rewrite prose around captured images
|
|
108
|
+
|
|
109
|
+
After capturing an image, go back to the doc page that references it and rewrite the paragraph or section surrounding that image. The placeholder was written with generic framing — now that you can see the actual screenshot, make the description specific and accurate.
|
|
110
|
+
|
|
111
|
+
Read the screenshot with the Read tool to inform the rewrite.
|
|
112
|
+
|
|
113
|
+
### Step 5 — Update manifest
|
|
114
|
+
|
|
115
|
+
For each successfully captured image, update `"placeholder": false` in the manifest and record the capture timestamp.
|
|
116
|
+
|
|
117
|
+
### Step 6 — Summary
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
Captured X of Y screenshots.
|
|
121
|
+
Skipped: [list any skipped with reason]
|
|
122
|
+
|
|
123
|
+
Rewrote prose in X doc pages.
|
|
124
|
+
|
|
125
|
+
Run /vitedocs:sync after future code changes to keep docs current.
|
|
126
|
+
```
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vitedocs:setup
|
|
3
|
+
description: Wire up VitePress + GitHub Actions for GitHub Pages deployment.
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Write
|
|
7
|
+
- Edit
|
|
8
|
+
- Bash
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- AskUserQuestion
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Manifest
|
|
15
|
+
|
|
16
|
+
All modes read and write a manifest at `.vitepress/docs-manifest.json`. This file is **local-only** — always add it to `.gitignore` (under the docs folder's nearest `.gitignore`) so it is never committed or distributed.
|
|
17
|
+
|
|
18
|
+
Add this line if not already present:
|
|
19
|
+
```
|
|
20
|
+
.vitepress/docs-manifest.json
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Manifest schema
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"generated": "ISO-8601 timestamp",
|
|
28
|
+
"project": {
|
|
29
|
+
"type": "user-facing | developer | both",
|
|
30
|
+
"baseUrl": "http://localhost:3000",
|
|
31
|
+
"serverType": "node | wordpress | static | other",
|
|
32
|
+
"startCommand": "npm run dev"
|
|
33
|
+
},
|
|
34
|
+
"pages": [
|
|
35
|
+
{
|
|
36
|
+
"file": "docs/guides/timer.md",
|
|
37
|
+
"title": "Running a Timer",
|
|
38
|
+
"docType": "user-facing",
|
|
39
|
+
"sources": ["src/state/timer.js", "src/components/layouts/workouts.jsx"],
|
|
40
|
+
"images": [
|
|
41
|
+
{
|
|
42
|
+
"path": "docs/public/screenshots/timer-main.png",
|
|
43
|
+
"placeholder": true,
|
|
44
|
+
"caption": "Timer in active interval state",
|
|
45
|
+
"captureUrl": "/workouts/123",
|
|
46
|
+
"captureNote": "Timer should be running with intervals visible"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"lastSynced": "ISO-8601 timestamp",
|
|
50
|
+
"syncHash": "sha of source file contents at last sync"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Mode: setup
|
|
59
|
+
|
|
60
|
+
### Step 1 — Gather project details
|
|
61
|
+
|
|
62
|
+
Use AskUserQuestion for each choice below. For freeform text inputs (repo URL, domain name, docs path) ask as plain text immediately after the relevant choice is made.
|
|
63
|
+
|
|
64
|
+
**Multiple focus paths:** if more than one path was established in Step 0, ask Q2 through Q6 once per path — fully completing all questions for the first path before starting the second. Never present questions for two paths at the same time.
|
|
65
|
+
|
|
66
|
+
**Q1 — VitePress status:**
|
|
67
|
+
- header: "VitePress"
|
|
68
|
+
- question: "Is VitePress already installed in this project?"
|
|
69
|
+
- options:
|
|
70
|
+
- "Already installed"
|
|
71
|
+
- "Starting from scratch"
|
|
72
|
+
|
|
73
|
+
**Q2 — Docs folder:**
|
|
74
|
+
- header: "Docs location"
|
|
75
|
+
- question: "Where should the docs folder be created? I found your repo at `[GIT_ROOT_PATH]`."
|
|
76
|
+
- options:
|
|
77
|
+
- "Here → `[GIT_ROOT_PATH]/docs/`"
|
|
78
|
+
- "Somewhere else — I'll type the path"
|
|
79
|
+
|
|
80
|
+
If "Somewhere else": ask as plain text — "What path should I use? (Full path or relative to `[GIT_ROOT_PATH]`)"
|
|
81
|
+
|
|
82
|
+
**Q3 — GitHub repo** (plain text): Ask — "What is the GitHub repo? (full URL or `owner/repo`)"
|
|
83
|
+
|
|
84
|
+
**Q4 — Domain type:**
|
|
85
|
+
- header: "Hosting"
|
|
86
|
+
- question: "Where will the docs be served?"
|
|
87
|
+
- options:
|
|
88
|
+
- "Custom domain I own (e.g. docs.myapp.com)"
|
|
89
|
+
- "GitHub Pages subdomain (e.g. owner.github.io/repo-name)"
|
|
90
|
+
|
|
91
|
+
If custom domain: ask as plain text — "What is the domain? (e.g. `docs.myapp.com`)"
|
|
92
|
+
|
|
93
|
+
**Q4b — Search engine visibility:**
|
|
94
|
+
- header: "Search visibility"
|
|
95
|
+
- question: "Should these docs be visible to search engines and bots?"
|
|
96
|
+
- options:
|
|
97
|
+
- "Yes — index these docs publicly"
|
|
98
|
+
- "No — block all search engines and bots"
|
|
99
|
+
|
|
100
|
+
If "No": add the following to the VitePress config's `head` array and write a `robots.txt` to the public folder:
|
|
101
|
+
|
|
102
|
+
`head` entry in `config.mjs`:
|
|
103
|
+
```js
|
|
104
|
+
head: [
|
|
105
|
+
['meta', { name: 'robots', content: 'noindex, nofollow' }],
|
|
106
|
+
]
|
|
107
|
+
```
|
|
108
|
+
If a `head` array already exists in the config, append to it — do not replace it.
|
|
109
|
+
|
|
110
|
+
`DOCS_FOLDER/public/robots.txt`:
|
|
111
|
+
```
|
|
112
|
+
User-agent: *
|
|
113
|
+
Disallow: /
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Q5 — Deploy trigger:**
|
|
117
|
+
- header: "Deploy trigger"
|
|
118
|
+
- question: "When should docs deploy?"
|
|
119
|
+
- options:
|
|
120
|
+
- "Every push to main"
|
|
121
|
+
- "Every push to a specific branch — I'll tell you which"
|
|
122
|
+
- "Only when a version tag is pushed (v*)"
|
|
123
|
+
- "Manual only (workflow_dispatch)"
|
|
124
|
+
|
|
125
|
+
If specific branch: ask as plain text — "Which branch?"
|
|
126
|
+
|
|
127
|
+
**Q6 — Docs on GitHub:**
|
|
128
|
+
- header: "Repo state"
|
|
129
|
+
- question: "Are the docs already committed and pushed to GitHub?"
|
|
130
|
+
- options:
|
|
131
|
+
- "Yes, already pushed"
|
|
132
|
+
- "No, this is all new"
|
|
133
|
+
|
|
134
|
+
Wait for all answers before proceeding.
|
|
135
|
+
|
|
136
|
+
### Step 2 — Prerequisites checklist
|
|
137
|
+
|
|
138
|
+
Present the relevant checklist as plain text, then use AskUserQuestion to confirm before writing files:
|
|
139
|
+
|
|
140
|
+
- header: "Ready to proceed?"
|
|
141
|
+
- question: "Have you completed the steps above?"
|
|
142
|
+
- options:
|
|
143
|
+
- "Yes, all done — generate the files"
|
|
144
|
+
- "Not yet — I need more time"
|
|
145
|
+
- "I have a question"
|
|
146
|
+
|
|
147
|
+
If "Not yet": tell the user to run `/vitedocs:setup` again when ready and exit.
|
|
148
|
+
If "I have a question": answer it, then re-ask this question.
|
|
149
|
+
|
|
150
|
+
The checklist to present (tailor to their answers):
|
|
151
|
+
|
|
152
|
+
**Always required:**
|
|
153
|
+
- [ ] GitHub repo exists with push access
|
|
154
|
+
- [ ] In repo **Settings → Pages**, set Source to **"GitHub Actions"**
|
|
155
|
+
_(You do not need to configure anything else here — the workflow handles the entire deployment. Just flip the source and leave everything else alone.)_
|
|
156
|
+
|
|
157
|
+
**If custom domain:**
|
|
158
|
+
- [ ] CNAME DNS record: `docs.yourdomain.com` → `<owner>.github.io`
|
|
159
|
+
- [ ] In repo **Settings → Pages → Custom domain**, enter the domain after DNS propagates
|
|
160
|
+
- [ ] TLS cert will provision automatically after first deploy
|
|
161
|
+
|
|
162
|
+
**If VitePress not installed:**
|
|
163
|
+
- [ ] Node.js 18+ installed
|
|
164
|
+
|
|
165
|
+
Before proceeding to Step 3, ask permission to handle the docs scaffold automatically:
|
|
166
|
+
|
|
167
|
+
- header: "Docs scaffold"
|
|
168
|
+
- question: "VitePress isn't installed yet. Can I create the docs folder and run the install for you?"
|
|
169
|
+
- options:
|
|
170
|
+
- "Yes — set it up for me"
|
|
171
|
+
- "No — I'll do it myself"
|
|
172
|
+
|
|
173
|
+
If yes, run:
|
|
174
|
+
```bash
|
|
175
|
+
mkdir -p DOCS_FOLDER
|
|
176
|
+
cd DOCS_FOLDER && npm init -y && npm install -D vitepress
|
|
177
|
+
```
|
|
178
|
+
Then confirm it succeeded before continuing.
|
|
179
|
+
If no, tell the user to run those two commands in the docs folder and come back when done.
|
|
180
|
+
|
|
181
|
+
**Playwright (required for screenshot mode):**
|
|
182
|
+
|
|
183
|
+
Check if it's already installed:
|
|
184
|
+
```bash
|
|
185
|
+
ls /opt/homebrew/lib/node_modules/playwright/index.mjs 2>/dev/null && echo "Found" || echo "Not found"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
If not found, install it:
|
|
189
|
+
```bash
|
|
190
|
+
brew install playwright
|
|
191
|
+
playwright install chrome
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
If the user is **not on macOS / Homebrew**, note that the screenshot mode hardcodes the Homebrew path. They'll need to find their global Playwright path (`npm root -g`) and will have to update the import line in any capture scripts the skill generates. Offer to help with that when screenshot mode is first used.
|
|
195
|
+
|
|
196
|
+
### Step 3 — Generate files
|
|
197
|
+
|
|
198
|
+
**`.github/workflows/docs.yml`** (at repo root, not inside docs folder):
|
|
199
|
+
|
|
200
|
+
```yaml
|
|
201
|
+
name: Deploy Docs
|
|
202
|
+
|
|
203
|
+
on:
|
|
204
|
+
push:
|
|
205
|
+
branches: [BRANCH] # from answer 5
|
|
206
|
+
workflow_dispatch:
|
|
207
|
+
|
|
208
|
+
permissions:
|
|
209
|
+
contents: read
|
|
210
|
+
pages: write
|
|
211
|
+
id-token: write
|
|
212
|
+
|
|
213
|
+
concurrency:
|
|
214
|
+
group: pages
|
|
215
|
+
cancel-in-progress: false
|
|
216
|
+
|
|
217
|
+
jobs:
|
|
218
|
+
build:
|
|
219
|
+
runs-on: ubuntu-latest
|
|
220
|
+
steps:
|
|
221
|
+
- uses: actions/checkout@v4
|
|
222
|
+
with:
|
|
223
|
+
fetch-depth: 0
|
|
224
|
+
- uses: actions/setup-node@v4
|
|
225
|
+
with:
|
|
226
|
+
node-version: 20
|
|
227
|
+
cache: npm
|
|
228
|
+
cache-dependency-path: DOCS_FOLDER/package-lock.json
|
|
229
|
+
- run: npm ci
|
|
230
|
+
working-directory: DOCS_FOLDER
|
|
231
|
+
- run: npm run build
|
|
232
|
+
working-directory: DOCS_FOLDER
|
|
233
|
+
- uses: actions/upload-pages-artifact@v3
|
|
234
|
+
with:
|
|
235
|
+
path: DOCS_FOLDER/.vitepress/dist
|
|
236
|
+
|
|
237
|
+
deploy:
|
|
238
|
+
environment:
|
|
239
|
+
name: github-pages
|
|
240
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
241
|
+
needs: build
|
|
242
|
+
runs-on: ubuntu-latest
|
|
243
|
+
steps:
|
|
244
|
+
- uses: actions/deploy-pages@v4
|
|
245
|
+
id: deployment
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Fill `BRANCH` and `DOCS_FOLDER` from answers. For tag-based triggers replace `branches` with `tags: ['v*']`. For manual-only, remove the `push:` block.
|
|
249
|
+
|
|
250
|
+
**VitePress config updates:**
|
|
251
|
+
|
|
252
|
+
Read the existing config before editing. Make only these targeted changes:
|
|
253
|
+
|
|
254
|
+
1. Set `base`:
|
|
255
|
+
- Custom domain → `base: '/'`
|
|
256
|
+
- GitHub subdomain → `base: '/repo-name/'`
|
|
257
|
+
|
|
258
|
+
2. Add PostCSS override if not already present. This prevents VitePress from inheriting a PostCSS config from a parent project (e.g. a Next.js or Laravel root that uses Tailwind), which would cause the Actions build to fail with a "Cannot find module" error:
|
|
259
|
+
```js
|
|
260
|
+
vite: {
|
|
261
|
+
css: {
|
|
262
|
+
postcss: {},
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
```
|
|
266
|
+
Always add this — it is harmless when there is no parent PostCSS config and critical when there is.
|
|
267
|
+
|
|
268
|
+
**`DOCS_FOLDER/public/CNAME`** (custom domain only):
|
|
269
|
+
```
|
|
270
|
+
docs.yourdomain.com
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
**`.gitignore` check:** ensure `node_modules` and `.vitepress/cache` are present.
|
|
274
|
+
|
|
275
|
+
### Step 4 — Summary
|
|
276
|
+
|
|
277
|
+
List files written and give the user a next-steps checklist with the expected deploy URL.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vitedocs:sync
|
|
3
|
+
description: Detect code drift and update docs that are out of date.
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Write
|
|
7
|
+
- Edit
|
|
8
|
+
- Bash
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- AskUserQuestion
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
This mode reads `.vitepress/docs-manifest.json`. Run `/vitedocs:generate` first if no manifest exists yet.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Mode: sync
|
|
19
|
+
|
|
20
|
+
### Step 1 — Gather sync preferences
|
|
21
|
+
|
|
22
|
+
**Q1 — Drift detection method:**
|
|
23
|
+
- header: "Sync method"
|
|
24
|
+
- question: "How should I check for drift?"
|
|
25
|
+
- options:
|
|
26
|
+
- "Git diff — compare code changes since last sync (fast)"
|
|
27
|
+
- "Full re-analysis — re-read source files and compare to docs (thorough)"
|
|
28
|
+
- "Both — git diff first, then deep re-analysis on flagged pages"
|
|
29
|
+
|
|
30
|
+
**Q2 — Update style:**
|
|
31
|
+
- header: "Update approach"
|
|
32
|
+
- question: "How should I handle pages that need updating?"
|
|
33
|
+
- options:
|
|
34
|
+
- "Update all automatically, then show me a summary"
|
|
35
|
+
- "Show me each changed page and confirm before updating"
|
|
36
|
+
|
|
37
|
+
Wait for answers.
|
|
38
|
+
|
|
39
|
+
### Step 2 — Detect drift
|
|
40
|
+
|
|
41
|
+
**Git diff approach:**
|
|
42
|
+
```bash
|
|
43
|
+
git diff --name-only LAST_SYNC_COMMIT HEAD
|
|
44
|
+
```
|
|
45
|
+
Get `LAST_SYNC_COMMIT` from the manifest's `generated` timestamp — find the nearest commit at or before that time with `git log --before="TIMESTAMP" -1 --format="%H"`.
|
|
46
|
+
|
|
47
|
+
Cross-reference changed files against the manifest's `sources` arrays to find which doc pages are affected.
|
|
48
|
+
|
|
49
|
+
**Full re-analysis approach:**
|
|
50
|
+
For each page in the manifest, re-read the source files listed in `sources`. Compute a hash of their current contents and compare to `syncHash`. Flag any mismatch as drifted.
|
|
51
|
+
|
|
52
|
+
**Both:** run git diff first for speed, then re-analyze only the flagged pages for depth.
|
|
53
|
+
|
|
54
|
+
### Step 3 — Report drift before changing anything
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
Found N pages with drift:
|
|
58
|
+
|
|
59
|
+
guides/timer.md — src/state/timer.js changed (interval logic updated)
|
|
60
|
+
developer/auth.md — src/proxy.js changed (new middleware added)
|
|
61
|
+
developer/api/users.md — src/app/api/users/route.js changed (new endpoint)
|
|
62
|
+
|
|
63
|
+
Images that may need recapture:
|
|
64
|
+
public/screenshots/timer-main.png — source page changed
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
If the user chose "confirm before each", use AskUserQuestion per page:
|
|
68
|
+
- header: "[filename]"
|
|
69
|
+
- question: "[source file] changed — [brief description of what changed]. Update this page?"
|
|
70
|
+
- options:
|
|
71
|
+
- "Yes — update it"
|
|
72
|
+
- "Skip this one"
|
|
73
|
+
- "Update all remaining without asking"
|
|
74
|
+
|
|
75
|
+
Otherwise update all and summarize at the end.
|
|
76
|
+
|
|
77
|
+
### Step 4 — Update affected pages
|
|
78
|
+
|
|
79
|
+
For each drifted page:
|
|
80
|
+
1. Re-read the source files
|
|
81
|
+
2. Update the relevant sections in the doc
|
|
82
|
+
3. Add a `<!-- GAP: ... -->` comment if something is now unclear
|
|
83
|
+
4. If images on the page likely show outdated UI, mark them as `"placeholder": true` again in the manifest and note that they need recapture
|
|
84
|
+
|
|
85
|
+
Do not touch pages that have not drifted.
|
|
86
|
+
|
|
87
|
+
### Step 5 — Update manifest
|
|
88
|
+
|
|
89
|
+
Update `lastSynced` and `syncHash` for all updated pages. Update the top-level `generated` timestamp.
|
|
90
|
+
|
|
91
|
+
### Step 6 — Summary
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
Updated X of N drifted pages.
|
|
95
|
+
X gap comments added for manual review.
|
|
96
|
+
Y screenshots flagged for recapture — run /vitedocs:screenshot when ready.
|
|
97
|
+
```
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vitedocs:update
|
|
3
|
+
description: Retrofit an existing VitePress docs setup with the latest components and dependencies.
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Write
|
|
7
|
+
- Edit
|
|
8
|
+
- Bash
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- AskUserQuestion
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Mode: update
|
|
15
|
+
|
|
16
|
+
Retrofits an existing VitePress docs setup with the latest components, dependencies, and theme wiring. Does not re-run setup or regenerate pages.
|
|
17
|
+
|
|
18
|
+
### Step 1 — Locate docs paths
|
|
19
|
+
|
|
20
|
+
Scan the current working directory and any known focus paths for `.vitepress/config.mjs` (or `.ts`) files. List what was found and ask the user to confirm which paths to update.
|
|
21
|
+
|
|
22
|
+
### Step 2 — Inventory current state
|
|
23
|
+
|
|
24
|
+
For each confirmed docs path, check what is already present:
|
|
25
|
+
|
|
26
|
+
- `.vitepress/components/ApiEndpoint.vue` — exists?
|
|
27
|
+
- `.vitepress/theme/index.js` — exists? includes `medium-zoom`? includes `ApiEndpoint`?
|
|
28
|
+
- `.vitepress/theme/index.css` — exists? includes `.medium-zoom-overlay` z-index rules?
|
|
29
|
+
- `package.json` — are `medium-zoom` and `highlight.js` listed in dependencies?
|
|
30
|
+
|
|
31
|
+
Report findings as a checklist:
|
|
32
|
+
```
|
|
33
|
+
Path: docs/
|
|
34
|
+
[x] ApiEndpoint.vue — found (needs update)
|
|
35
|
+
[ ] medium-zoom installed
|
|
36
|
+
[x] highlight.js installed
|
|
37
|
+
[x] theme/index.js — found (missing medium-zoom wiring)
|
|
38
|
+
[x] theme/index.css — found (missing z-index rules)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Then ask:
|
|
42
|
+
|
|
43
|
+
- header: "Update"
|
|
44
|
+
- question: "What would you like to update?"
|
|
45
|
+
- options:
|
|
46
|
+
- "Everything that's missing or outdated"
|
|
47
|
+
- "Let me choose item by item"
|
|
48
|
+
|
|
49
|
+
### Step 3 — Gather inputs (only if needed)
|
|
50
|
+
|
|
51
|
+
If `ApiEndpoint.vue` is being written or updated and no existing `apiBase` is in the VitePress config, ask:
|
|
52
|
+
|
|
53
|
+
**U-Q1 — API base URL** (plain text): "What is the API base URL? (e.g. `https://api.example.com/wp-json/my-plugin/v1`)"
|
|
54
|
+
|
|
55
|
+
**U-Q2 — Code sample tabs:**
|
|
56
|
+
- header: "Code tabs"
|
|
57
|
+
- question: "Which code sample tabs should the ApiEndpoint component show?"
|
|
58
|
+
- options:
|
|
59
|
+
- "Fetch + cURL (default)"
|
|
60
|
+
- "Fetch + cURL + PHP"
|
|
61
|
+
- "Fetch + cURL + Python"
|
|
62
|
+
- "Fetch + cURL + Axios"
|
|
63
|
+
- "All of the above"
|
|
64
|
+
- "Custom — I'll list them"
|
|
65
|
+
|
|
66
|
+
Skip U-Q1 and U-Q2 if `apiBase` already exists in `.vitepress/config.mjs` `themeConfig` — infer `apiBase` and existing tabs from the config and the current `ApiEndpoint.vue`.
|
|
67
|
+
|
|
68
|
+
### Step 4 — Apply updates
|
|
69
|
+
|
|
70
|
+
Apply only the items selected (or all missing/outdated items if "Everything" was chosen). Always read existing files before editing — never overwrite unrelated content.
|
|
71
|
+
|
|
72
|
+
**`ApiEndpoint.vue`** — write the full component from the template in generate Step 6, substituting the correct tab list. If the file already exists, replace it entirely (it is a generated component, not hand-edited).
|
|
73
|
+
|
|
74
|
+
**`medium-zoom` + `highlight.js`** — if either is missing from `package.json` dependencies, run:
|
|
75
|
+
```bash
|
|
76
|
+
cd DOCS_FOLDER && npm install medium-zoom highlight.js
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**`.vitepress/theme/index.css`** — if `.medium-zoom-overlay` z-index block is missing, append:
|
|
80
|
+
```css
|
|
81
|
+
.medium-zoom-overlay {
|
|
82
|
+
z-index: 100;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.medium-zoom-image--opened {
|
|
86
|
+
z-index: 101;
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
Do not remove or overwrite existing entries.
|
|
90
|
+
|
|
91
|
+
**`.vitepress/theme/index.js`** — merge only what is missing:
|
|
92
|
+
- If `medium-zoom` wiring is absent, add the `onMounted`/`watch` setup block
|
|
93
|
+
- If `ApiEndpoint` registration is absent (and `apiBase` is configured), add the import and `app.component()` call
|
|
94
|
+
- Never remove existing registrations or setup logic
|
|
95
|
+
|
|
96
|
+
Reference template for the full correct state:
|
|
97
|
+
```js
|
|
98
|
+
import DefaultTheme from 'vitepress/theme'
|
|
99
|
+
import { onMounted, watch, nextTick } from 'vue'
|
|
100
|
+
import { useRoute } from 'vitepress'
|
|
101
|
+
import mediumZoom from 'medium-zoom'
|
|
102
|
+
import './index.css'
|
|
103
|
+
import ApiEndpoint from '../components/ApiEndpoint.vue'
|
|
104
|
+
|
|
105
|
+
export default {
|
|
106
|
+
extends: DefaultTheme,
|
|
107
|
+
setup() {
|
|
108
|
+
const route = useRoute()
|
|
109
|
+
const initZoom = () => mediumZoom('.main img', { background: 'var(--vp-c-bg)' })
|
|
110
|
+
onMounted(initZoom)
|
|
111
|
+
watch(() => route.path, () => nextTick(initZoom))
|
|
112
|
+
},
|
|
113
|
+
enhanceApp({ app }) {
|
|
114
|
+
app.component('ApiEndpoint', ApiEndpoint)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**`.vitepress/config.mjs`** — if `apiBase` was collected and is not already in `themeConfig`, add it.
|
|
120
|
+
|
|
121
|
+
### Step 5 — Summary
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
Updated X of Y docs path(s).
|
|
125
|
+
|
|
126
|
+
Changes applied:
|
|
127
|
+
PATH/.vitepress/components/ApiEndpoint.vue — written
|
|
128
|
+
PATH/.vitepress/theme/index.js — merged medium-zoom + ApiEndpoint
|
|
129
|
+
PATH/.vitepress/theme/index.css — added z-index rules
|
|
130
|
+
PATH/package.json — installed medium-zoom, highlight.js
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Notes
|
|
136
|
+
|
|
137
|
+
- Never write the GitHub Actions workflow inside the docs folder — it goes in `.github/workflows/` at the repo root.
|
|
138
|
+
- Always read an existing config before editing it — never rewrite the whole file.
|
|
139
|
+
- For non-Node stacks in screenshot mode (WordPress, PHP, static): do not attempt to start a server. Just ask for the URL.
|
|
140
|
+
- `workflow_dispatch` should always be present in the workflow so manual deploys are possible.
|
|
141
|
+
- Do not use `peaceiris/actions-gh-pages` — use `actions/upload-pages-artifact` + `actions/deploy-pages`.
|
|
142
|
+
- The manifest is intentionally not committed. Each environment generates its own. Don't suggest committing it.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iamdangavin/claude-skill-vitepress-docs",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Installs the vitedocs: Claude Code skill suite — VitePress docs setup, generate, screenshot, sync, brand, and update.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|