@abstractdata/starlight-theme 0.3.1 → 0.3.3
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/README.md +7 -2
- package/bin/install-skills.js +251 -0
- package/package.json +12 -6
- package/scripts/build-python-docs.mjs +385 -0
- package/scripts/build-ts-docs.mjs +349 -0
- package/scripts/python-autodoc.json +10 -0
- package/scripts/ts-autodoc.json +10 -0
- package/skills/claude/CLAUDE.md +46 -0
- package/skills/claude/abstract-data-docs-author/SKILL.md +305 -0
- package/skills/claude/abstract-data-setup/SKILL.md +555 -0
- package/skills/cursor/abstract-data-docs-author.mdc +311 -0
- package/skills/cursor/abstract-data-setup.mdc +561 -0
- package/skills/cursor/welcome.mdc +29 -0
- package/skills/github/copilot-instructions.md +893 -0
- package/src/components/SocialIcons.astro +17 -2
- package/src/components/VersionPicker.astro +238 -0
- package/src/index.ts +17 -1
- package/src/styles/hud.css +222 -210
- package/src/styles/theme.css +444 -432
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: abstract-data-setup
|
|
3
|
+
description: Set up the Abstract Data Documentation Theme (built on Astro Starlight) for a project. Detect source code across stacks (Python, TypeScript, Next.js, TanStack, OpenAPI, Prisma, Drizzle), audit docstring coverage for Python, sniff docstring style (Google/NumPy/Sphinx), detect or pick a logo asset, ask configuration questions (modules/entry points, motion, credit, version), wire up config files (scripts/python-autodoc.json, scripts/ts-autodoc.json, astro.config.mjs sidebar + plugin options, package.json scripts), and optionally install a docstring-coverage pre-commit hook. Use when the user says "set up docs", "configure docs", "wire up Python autodoc", "wire up TypeScript autodoc", "scan my project for docs", "set up Abstract Data docs", "add API reference", "audit docstrings", or similar phrases inside a docs project that uses @abstractdata/starlight-theme (the npm package name; product is the Abstract Data Documentation Theme).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Abstract Data Documentation Theme — Setup
|
|
7
|
+
|
|
8
|
+
Bootstrap the Abstract Data Documentation Theme — the branded docs system Abstract Data uses across client projects, built on Astro Starlight and shipped as the npm package `@abstractdata/starlight-theme`. Round 2 covers Python and TypeScript autodoc with full automation, plus detection-and-recipe handling for Next.js, TanStack Router, OpenAPI, Prisma, and Drizzle.
|
|
9
|
+
|
|
10
|
+
## When to invoke
|
|
11
|
+
|
|
12
|
+
Run this skill when the user says "set up docs", "configure docs", "wire up Python autodoc", "wire up TypeScript autodoc", "scan my project for docs", "audit docstrings", or similar inside a project that has `@abstractdata/starlight-theme` in its `package.json`. If the cwd doesn't have that dep, stop and point them at `bun create @abstractdata/docs`.
|
|
13
|
+
|
|
14
|
+
## Workflow
|
|
15
|
+
|
|
16
|
+
Use interactive prompts for every choice — never assume.
|
|
17
|
+
|
|
18
|
+
### Phase 1 — Confirm context
|
|
19
|
+
|
|
20
|
+
Read `package.json`. Verify `@abstractdata/starlight-theme` is in deps; verify `astro.config.mjs` and `src/content/docs/` exist. Stop with a clear message if any check fails. Don't ask the user to confirm — just announce findings and move on.
|
|
21
|
+
|
|
22
|
+
### Phase 2 — Locate the source project(s)
|
|
23
|
+
|
|
24
|
+
Ask via interactive prompt: where does the source project live?
|
|
25
|
+
- "This directory" — docs ARE the source (rare)
|
|
26
|
+
- "Parent directory (..)" — docs sit inside the source repo
|
|
27
|
+
- "Sibling directory" — separate repos at the same level
|
|
28
|
+
- "Custom path" — prompt for it
|
|
29
|
+
|
|
30
|
+
Validate the path exists. Reprompt on invalid.
|
|
31
|
+
|
|
32
|
+
### Phase 3 — Detect all stack signals
|
|
33
|
+
|
|
34
|
+
In the source path, scan for these signals in parallel. Report what you find before asking any per-stack questions.
|
|
35
|
+
|
|
36
|
+
**Python:**
|
|
37
|
+
- `pyproject.toml`, `setup.py`, `requirements.txt`, `Pipfile`
|
|
38
|
+
- `src/<pkg>/__init__.py` or `<pkg>/__init__.py`
|
|
39
|
+
|
|
40
|
+
**TypeScript library:**
|
|
41
|
+
- `tsconfig.json` AND `package.json` with `main`/`exports`/`types` fields
|
|
42
|
+
- `src/index.ts` or similar entry point
|
|
43
|
+
|
|
44
|
+
**Next.js:**
|
|
45
|
+
- `next.config.{js,mjs,ts}`
|
|
46
|
+
- `app/` directory (App Router) or `pages/` directory (Pages Router)
|
|
47
|
+
- `next` in dependencies
|
|
48
|
+
|
|
49
|
+
**TanStack Router / Start:**
|
|
50
|
+
- `@tanstack/react-router`, `@tanstack/react-start`, or `@tanstack/start` in dependencies
|
|
51
|
+
- `src/routes/` directory
|
|
52
|
+
- `src/routeTree.gen.ts` (generated route tree)
|
|
53
|
+
|
|
54
|
+
**OpenAPI:**
|
|
55
|
+
- `openapi.yaml`, `openapi.json`, `swagger.yaml`, `swagger.json`
|
|
56
|
+
- Files matching `*.openapi.{yaml,json}`
|
|
57
|
+
|
|
58
|
+
**Prisma:**
|
|
59
|
+
- `prisma/schema.prisma`
|
|
60
|
+
|
|
61
|
+
**Drizzle:**
|
|
62
|
+
- `drizzle.config.{ts,js}`
|
|
63
|
+
- Files in a `schema/` directory exporting `pgTable` / `mysqlTable` / `sqliteTable`
|
|
64
|
+
|
|
65
|
+
**Logo asset (in the docs project, not the source):**
|
|
66
|
+
- `src/assets/*.{png,svg,jpg,jpeg,webp}` — anything that looks like a logo (`logo.*`, `*-logo.*`, `brand.*`)
|
|
67
|
+
|
|
68
|
+
Display the detection summary in a table:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
Stack Detected Action
|
|
72
|
+
Python yes will offer Python autodoc
|
|
73
|
+
TypeScript yes will offer TypeScript autodoc
|
|
74
|
+
Next.js no —
|
|
75
|
+
TanStack yes recipe-only (no auto-config)
|
|
76
|
+
OpenAPI no —
|
|
77
|
+
Prisma yes recipe-only (no auto-config)
|
|
78
|
+
Drizzle no —
|
|
79
|
+
Logo 1 file will confirm choice
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
If no source signals at all → exit politely.
|
|
83
|
+
|
|
84
|
+
### Phase 4 — Python: audit + style (only if Python detected)
|
|
85
|
+
|
|
86
|
+
#### 4a — Audit docstring coverage
|
|
87
|
+
|
|
88
|
+
Preferred tool: `interrogate` (`pipx install pydoc-markdown` first if not installed). Fall back to a Python AST one-liner. Categorize per-module:
|
|
89
|
+
- **≥ 80%** green
|
|
90
|
+
- **50-79%** yellow
|
|
91
|
+
- **< 50%** red
|
|
92
|
+
|
|
93
|
+
Show the table; don't editorialize.
|
|
94
|
+
|
|
95
|
+
#### 4b — Detect docstring style
|
|
96
|
+
|
|
97
|
+
Sample 10–20 docstrings, count distinctive markers (Google `Args:`/`Returns:`, NumPy `Parameters\n----`, Sphinx `:param x:`). Pick the leader if it has ≥60% of markers; otherwise call it "mixed."
|
|
98
|
+
|
|
99
|
+
### Phase 5 — TypeScript: entry-point detection (only if TS library detected)
|
|
100
|
+
|
|
101
|
+
Read `package.json` `main`/`exports`/`types` fields. Walk `src/` for `index.ts` files. Build a candidate list of entry points (one per public module surface).
|
|
102
|
+
|
|
103
|
+
Common shapes:
|
|
104
|
+
- Single entry: `src/index.ts` → one entry point
|
|
105
|
+
- Multi-entry: `package.json` `exports` lists multiple → one entry per exported subpath
|
|
106
|
+
- Monorepo: each package has its own entry
|
|
107
|
+
|
|
108
|
+
#### 5a — Audit TSDoc coverage
|
|
109
|
+
|
|
110
|
+
Mirror Phase 4a for TypeScript. Run TypeDoc in **validation-only** mode against the chosen entry points:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
bunx typedoc \
|
|
114
|
+
--plugin typedoc-plugin-markdown \
|
|
115
|
+
--validation.notDocumented \
|
|
116
|
+
--treatValidationWarningsAsErrors false \
|
|
117
|
+
--emit none \
|
|
118
|
+
<entryPoints>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Parse the resulting warnings — TypeDoc emits one line per undocumented symbol with `[warning]` prefix. Group by source file and report per-file coverage as a percentage of public exports that have at least one TSDoc block. Use the same color thresholds as the Python audit:
|
|
122
|
+
|
|
123
|
+
- **≥ 80%** green
|
|
124
|
+
- **50–79%** yellow
|
|
125
|
+
- **< 50%** red
|
|
126
|
+
|
|
127
|
+
If TypeDoc isn't installed yet, fall back to a quick AST sniff: count files in `src/` with `/**` blocks vs total exported declarations. Coarser, but no install required.
|
|
128
|
+
|
|
129
|
+
Show the table; don't editorialize. The result feeds Phase 12 (pre-commit hook offer).
|
|
130
|
+
|
|
131
|
+
### Phase 6 — Logo detection
|
|
132
|
+
|
|
133
|
+
Scan `src/assets/**/*.{png,svg,jpg,jpeg,webp}` recursively. Build candidate categories:
|
|
134
|
+
|
|
135
|
+
- **Topbar mark candidates**: filename matches `(logo|brand|mark|icon)\.(svg|png|webp)$` (case-insensitive). SVG preferred.
|
|
136
|
+
- **Light/dark pair**: filenames contain `light` or `dark` and otherwise match logo conventions (e.g. `logo-light.svg` + `logo-dark.svg`). Starlight supports both via `logo.light` + `logo.dark`.
|
|
137
|
+
- **Hero candidates**: any image larger than ~80KB or with `hero` / `splash` in the name — usually a bigger variant for the splash page.
|
|
138
|
+
- **Other images**: no logo conventions; treat as miscellaneous.
|
|
139
|
+
|
|
140
|
+
For each candidate, gather:
|
|
141
|
+
- File size in bytes
|
|
142
|
+
- Format (extension)
|
|
143
|
+
- Whether the filename indicates light/dark intent
|
|
144
|
+
|
|
145
|
+
Display a 4-7 line summary table:
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
File Size Format Suggested role
|
|
149
|
+
src/assets/logo.svg 12 KB SVG topbar mark (recommended)
|
|
150
|
+
src/assets/logo-light.svg 12 KB SVG topbar (light mode)
|
|
151
|
+
src/assets/logo-dark.svg 12 KB SVG topbar (dark mode)
|
|
152
|
+
src/assets/hero-mark.png 145 KB PNG splash hero image
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Branch on what you found:
|
|
156
|
+
|
|
157
|
+
- **One mark + light/dark pair** → propose using the pair (Starlight handles auto-switching by `data-theme`)
|
|
158
|
+
- **One mark, no pair** → propose using it for both modes
|
|
159
|
+
- **Multiple marks, no clear winner** → multiselect: which for topbar? Which for hero? `multiSelect: true` interactive prompt.
|
|
160
|
+
- **Zero candidates** → ask: "I don't see a logo in `src/assets/`. Drop one in (SVG preferred, ~256x256 minimum), tell me where it is, or skip for now and configure manually later."
|
|
161
|
+
|
|
162
|
+
Format guidance to surface alongside the prompt:
|
|
163
|
+
- SVG renders crispest at any size; preferred for both topbar and hero.
|
|
164
|
+
- PNG works fine; 256×256 minimum for the topbar (Astro will downscale via the asset pipeline).
|
|
165
|
+
- JPG is fine for hero photos but bad for marks (compression artifacts on edges).
|
|
166
|
+
- Files > 200KB will bloat first-paint; suggest optimizing or using a smaller source.
|
|
167
|
+
|
|
168
|
+
### Phase 7 — Recommend documentation surfaces
|
|
169
|
+
|
|
170
|
+
For each detected stack, ask whether to wire it up. Stack questions are per-stack, not lumped together.
|
|
171
|
+
|
|
172
|
+
#### Python (if detected)
|
|
173
|
+
|
|
174
|
+
Interactive prompt with up to 4 options:
|
|
175
|
+
- "Top-level package only" (Recommended)
|
|
176
|
+
- "All green-coverage modules" (≥80%)
|
|
177
|
+
- "Specific submodules I'll pick" → multiselect
|
|
178
|
+
- "Everything" (warn about red-coverage modules)
|
|
179
|
+
|
|
180
|
+
#### TypeScript (if detected)
|
|
181
|
+
|
|
182
|
+
Interactive prompt:
|
|
183
|
+
- "Single root entry point (src/index.ts)" (Recommended for libs with one public API)
|
|
184
|
+
- "All paths in package.json `exports`" (Recommended for multi-entry libs)
|
|
185
|
+
- "I'll pick specific entry points" → free-form
|
|
186
|
+
|
|
187
|
+
#### Other detected stacks (Next.js, TanStack, OpenAPI, Prisma, Drizzle)
|
|
188
|
+
|
|
189
|
+
Don't auto-configure. Tell the user the recipe and let them follow up:
|
|
190
|
+
|
|
191
|
+
- **Next.js**: "I detected Next.js. There isn't a standard one-shot route documenter, but you can write a small build script that walks `app/` or `pages/` and emits a `routes.md`. Want me to draft one?"
|
|
192
|
+
- **TanStack Router**: "I detected TanStack Router. Generate a route map by importing `routeTree.gen.ts` and walking it in a build script. Want a starter?"
|
|
193
|
+
- **OpenAPI**: "I detected an OpenAPI spec. Recommend `@astrojs/starlight-openapi` for the cleanest integration. Want me to install it and wire it up?"
|
|
194
|
+
- **Prisma**: "I detected a Prisma schema. Try `prisma-markdown` for schema docs. Want me to add it to dev deps and wire a script?"
|
|
195
|
+
- **Drizzle**: "I detected a Drizzle config. There isn't a mature schema-to-markdown tool yet — most teams write their own walker over the schema exports. Want me to draft a starter?"
|
|
196
|
+
|
|
197
|
+
If the user says yes to any of these, fall back to free-form work — these aren't covered by the main config files.
|
|
198
|
+
|
|
199
|
+
### Phase 7.5 — Optional Starlight plugins
|
|
200
|
+
|
|
201
|
+
Three plugins are cheap, high-value DX wins for most docs sites. Don't auto-install — surface them as an interactive multi-select prompt with sensible per-project defaults. Skip the prompt entirely if the user has already declined them in a previous run (look for a `.abstractdata-setup.json` marker or for the plugins already being absent + the import already pruned).
|
|
202
|
+
|
|
203
|
+
For each, you decide the default based on signals you've already gathered:
|
|
204
|
+
|
|
205
|
+
- **`starlight-llms-txt`** — emits an `llms.txt` summary at `/llms.txt` (per [llmstxt.org](https://llmstxt.org)) so AI crawlers can ingest the site as plain Markdown rather than parsing rendered HTML. **Default: ON.** No real downside.
|
|
206
|
+
- **`@expressive-code/plugin-package-managers`** *(code-block plugin, not a Starlight plugin)* — auto-renders npm/pnpm/yarn/bun tabs from a single `npm install foo` code block. **Default: ON if** the README, quickstart, or any docs page contains `bun add`, `npm install`, `pnpm add`, or `yarn add`. **Default: OFF otherwise.**
|
|
207
|
+
- **`starlight-image-zoom`** — click-to-zoom on images. **Default: ON if** the docs project has more than ~5 images under `src/assets/` or `src/content/docs/**/*.{png,jpg,svg,webp}` (a heuristic for "this site uses screenshots"). **Default: OFF otherwise.**
|
|
208
|
+
|
|
209
|
+
Show the user the three options with their suggested defaults pre-checked, and let them un-check / toggle. For each accepted plugin:
|
|
210
|
+
|
|
211
|
+
1. Add to `dependencies` in `package.json`.
|
|
212
|
+
2. Add the import to `astro.config.mjs`.
|
|
213
|
+
3. Wire the plugin entry into the `plugins` array (or `expressiveCode.plugins` for the package-managers plugin).
|
|
214
|
+
4. Tell the user the bun command to run: `bun add <plugin-name>`.
|
|
215
|
+
|
|
216
|
+
Show the resulting diff before writing. Don't run `bun add` yourself — the user does it.
|
|
217
|
+
|
|
218
|
+
### Phase 8 — Gather brand + contributor-loop configuration
|
|
219
|
+
|
|
220
|
+
Read existing `astro.config.mjs`. If `motion`, `credit`, `version`, `lastUpdated`, and `editLink` are already set and the user hasn't asked to change them, skip this phase.
|
|
221
|
+
|
|
222
|
+
Otherwise, batch into one prompt:
|
|
223
|
+
|
|
224
|
+
1. Motion: full | calm (Recommended)
|
|
225
|
+
2. Credit: auto | hide
|
|
226
|
+
3. Version chip: show with version string | omit
|
|
227
|
+
4. **Last-updated timestamps** (Recommended on): renders a "Last updated" footer on each page using `git log`. Requires a git checkout at build time. Set `lastUpdated: true` if yes, omit otherwise.
|
|
228
|
+
5. **"Edit on GitHub" link** (Recommended on for OSS): renders an Edit link in the footer pointing at the source. Needs a repo URL — derive it from `package.json` `repository.url` or the source-project remote (`git remote get-url origin`). If found, write `editLink: { baseUrl: '<repo>/edit/<default-branch>/' }`; if not, leave the commented-out scaffold in place and tell the user how to fill it in.
|
|
229
|
+
|
|
230
|
+
Both items 4 and 5 are cheap, high-impact contributor-loop wins per the Astro/Starlight best-practices guide — default to enabling them unless the user opts out.
|
|
231
|
+
|
|
232
|
+
### Phase 9 — Configure logo
|
|
233
|
+
|
|
234
|
+
Two surfaces need updating:
|
|
235
|
+
|
|
236
|
+
**a) Topbar logo — `astro.config.mjs` `starlight.logo`**
|
|
237
|
+
|
|
238
|
+
First, look at what Phase 6 detected. Three branches:
|
|
239
|
+
|
|
240
|
+
1. **Phase 6 found a light/dark pair** (e.g. `logo-light.svg` + `logo-dark.svg`) → use the `{ light, dark }` form. Starlight auto-switches based on `data-theme`. Don't ask which to use as the default — both render at the right time.
|
|
241
|
+
|
|
242
|
+
2. **Phase 6 found a single mark** → use the single-`src` form. Optionally suggest the user create a dark variant later if the mark is colored in a way that won't survive a dark background.
|
|
243
|
+
|
|
244
|
+
3. **Phase 6 found nothing** → leave the existing commented `// logo: { ... }` block in `astro.config.mjs` and tell the user where to drop a logo file.
|
|
245
|
+
|
|
246
|
+
Then ask one final question (skip if you already know): does the logo include the project name as text/wordmark?
|
|
247
|
+
|
|
248
|
+
- **Yes** (logo + wordmark in one image) → `replacesTitle: true` — Starlight hides the text title and shows just the logo.
|
|
249
|
+
- **No** (just a mark/icon, no text) → `replacesTitle: false` — Starlight shows the mark beside the text title.
|
|
250
|
+
|
|
251
|
+
Then write the config:
|
|
252
|
+
|
|
253
|
+
```js
|
|
254
|
+
// Single mark
|
|
255
|
+
logo: {
|
|
256
|
+
src: './src/assets/logo.svg',
|
|
257
|
+
replacesTitle: false,
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Light/dark pair (preferred when Phase 6 found both files)
|
|
261
|
+
logo: {
|
|
262
|
+
light: './src/assets/logo-light.svg',
|
|
263
|
+
dark: './src/assets/logo-dark.svg',
|
|
264
|
+
replacesTitle: true,
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
If a `logo:` block already exists in the config, edit it in place — don't add a duplicate. If `logo:` is in a comment or commented-out, uncomment and update.
|
|
269
|
+
|
|
270
|
+
**b) Splash hero image — `src/content/docs/index.mdx` `hero.image.file`**
|
|
271
|
+
|
|
272
|
+
Default Starlight splash hero supports a separate (usually larger) image. Check the existing `index.mdx` frontmatter:
|
|
273
|
+
|
|
274
|
+
```yaml
|
|
275
|
+
hero:
|
|
276
|
+
image:
|
|
277
|
+
file: ../../assets/hero-mark.png
|
|
278
|
+
alt: <project name>
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
If a hero candidate was identified in Phase 6, update this path. If the same logo serves both roles, point both at the same file. If the user wants to use the branded `<Hero>` MDX component (richer than the frontmatter hero), point them at the migration guide section that covers it.
|
|
282
|
+
|
|
283
|
+
**Verify after writing:**
|
|
284
|
+
|
|
285
|
+
After both surfaces are updated, encourage the user to run `bun dev` and visually confirm the logo renders correctly in both light and dark modes (toggle from the topbar). Common issues:
|
|
286
|
+
- Logo is white-on-white in light mode → need a dark variant or use the `light`/`dark` pair pattern
|
|
287
|
+
- Logo is way too small/large → adjust the source dimensions or add CSS overrides via `customCss`
|
|
288
|
+
- File path is wrong → relative paths in `astro.config.mjs` are relative to the project root, not the file itself
|
|
289
|
+
|
|
290
|
+
### Phase 10 — Write configs
|
|
291
|
+
|
|
292
|
+
Show diffs in your reasoning before writing.
|
|
293
|
+
|
|
294
|
+
#### a) `scripts/python-autodoc.json` (if Python wired up)
|
|
295
|
+
|
|
296
|
+
```json
|
|
297
|
+
{
|
|
298
|
+
"searchPath": "<relative path>",
|
|
299
|
+
"modules": [...],
|
|
300
|
+
"outputDir": "src/content/docs/api"
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
#### b) `scripts/ts-autodoc.json` (if TypeScript wired up)
|
|
305
|
+
|
|
306
|
+
```json
|
|
307
|
+
{
|
|
308
|
+
"entryPoints": [...],
|
|
309
|
+
"tsconfig": "<relative path>",
|
|
310
|
+
"outputDir": "src/content/docs/api/ts"
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
#### c) `astro.config.mjs`
|
|
315
|
+
|
|
316
|
+
Multi-edit:
|
|
317
|
+
|
|
318
|
+
1. Sidebar — ensure entries exist for each enabled generator:
|
|
319
|
+
- `{ label: 'Python API', autogenerate: { directory: 'api' } }` — if Python
|
|
320
|
+
- `{ label: 'TypeScript API', autogenerate: { directory: 'api/ts' } }` — if TS
|
|
321
|
+
2. Plugin call — update `motion`/`credit`/`version` from Phase 8.
|
|
322
|
+
3. Logo — update `logo.src` from Phase 9.
|
|
323
|
+
|
|
324
|
+
Don't duplicate sidebar entries. Don't add a second `abstractData(...)` plugin call.
|
|
325
|
+
|
|
326
|
+
#### d) `package.json`
|
|
327
|
+
|
|
328
|
+
Add scripts conditionally:
|
|
329
|
+
- `"docs:python": "node scripts/build-python-docs.mjs"` — if Python wired up
|
|
330
|
+
- `"docs:ts": "node scripts/build-ts-docs.mjs"` — if TS wired up
|
|
331
|
+
|
|
332
|
+
Update the `build` script to chain them:
|
|
333
|
+
```json
|
|
334
|
+
"build": "bun run docs:python && bun run docs:ts && astro check && astro build"
|
|
335
|
+
```
|
|
336
|
+
(Skip the chains for stacks not enabled.)
|
|
337
|
+
|
|
338
|
+
#### e) Required dev deps for TS
|
|
339
|
+
|
|
340
|
+
If TS wired up, add to dev deps:
|
|
341
|
+
```bash
|
|
342
|
+
bun add -d typedoc typedoc-plugin-markdown
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
Tell the user to run this; don't run it yourself.
|
|
346
|
+
|
|
347
|
+
#### f) Tailor `src/content/docs/quickstart.md` to the detected stack
|
|
348
|
+
|
|
349
|
+
The scaffolded `quickstart.md` ships with both Python and TypeScript autodoc subsections wrapped in HTML comment markers:
|
|
350
|
+
|
|
351
|
+
```html
|
|
352
|
+
<!-- abstract-data-setup:python-autodoc -->
|
|
353
|
+
…Python instructions…
|
|
354
|
+
<!-- /abstract-data-setup:python-autodoc -->
|
|
355
|
+
|
|
356
|
+
<!-- abstract-data-setup:ts-autodoc -->
|
|
357
|
+
…TypeScript instructions…
|
|
358
|
+
<!-- /abstract-data-setup:ts-autodoc -->
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
After you've finalized the stack(s) for this project (Phase 7), edit `quickstart.md` to remove the irrelevant block:
|
|
362
|
+
|
|
363
|
+
- **Python only** → strip everything between `<!-- abstract-data-setup:ts-autodoc -->` and `<!-- /abstract-data-setup:ts-autodoc -->` (inclusive).
|
|
364
|
+
- **TypeScript only** → strip the Python block similarly.
|
|
365
|
+
- **Both** → leave both blocks; remove only the comment markers themselves so the published page is clean.
|
|
366
|
+
- **Neither** (no autodoc wired up) → strip both blocks plus the "## Add API reference" heading and intro paragraph.
|
|
367
|
+
|
|
368
|
+
This is idempotent: re-runs of the skill check whether the markers still exist before pruning. If the user has already removed the markers (or hand-edited the file), leave it alone — never re-inject content into a customized quickstart.
|
|
369
|
+
|
|
370
|
+
### Phase 11 — Optionally run generators
|
|
371
|
+
|
|
372
|
+
Per enabled generator, ask: "Generate now? [Yes / No]"
|
|
373
|
+
|
|
374
|
+
- Python → `bun run docs:python`
|
|
375
|
+
- TypeScript → `bun run docs:ts`
|
|
376
|
+
|
|
377
|
+
Pass through any tool-not-installed errors verbatim.
|
|
378
|
+
|
|
379
|
+
### Phase 11.5 — Offer docs-author dispatch (if generators ran)
|
|
380
|
+
|
|
381
|
+
After generation, scan `src/content/docs/api/` for **thin pages** — auto-generated files whose body (after frontmatter and the auto-rendered H1) is fewer than ~200 bytes, OR pages that consist of just signatures with no descriptive prose. These are the "what the heck is this?" pages — the source's docstrings are too sparse for the mechanical autodoc to produce useful output.
|
|
382
|
+
|
|
383
|
+
If any thin pages are found, surface this to the user:
|
|
384
|
+
|
|
385
|
+
> "I noticed N of the generated API pages are sparse — your source's docstrings are thin. The companion skill `abstract-data-docs-author` reads the source code itself and writes narrative prose to enrich those pages (module overview, usage example from tests, related-modules cross-references). Want me to invoke it now?"
|
|
386
|
+
|
|
387
|
+
If yes: hand off to the `abstract-data-docs-author` skill (Claude Code: load the skill at `.claude/skills/abstract-data-docs-author/SKILL.md`; Cursor: refer to `.cursor/rules/abstract-data-docs-author.mdc`). Pass along the project profile and detected stack info so the docs-author skill doesn't have to re-discover.
|
|
388
|
+
|
|
389
|
+
If no thin pages found, skip this phase silently. Don't push the docs-author skill on a project that doesn't need it.
|
|
390
|
+
|
|
391
|
+
### Phase 11.7 — Versioned API reference (only if source has 2+ tags)
|
|
392
|
+
|
|
393
|
+
Run `git -C <source-repo> tag --list 'v*' | wc -l` (or equivalent) on the **source** repo (not the docs project). If the result is < 2, skip this phase silently.
|
|
394
|
+
|
|
395
|
+
Otherwise, surface the choice:
|
|
396
|
+
|
|
397
|
+
> "I see your source has N tagged releases. Versioned API reference is supported four ways. Which do you want?"
|
|
398
|
+
|
|
399
|
+
Multi-choice prompt:
|
|
400
|
+
|
|
401
|
+
1. **Source-driven (Recommended for API-only versioning).** Adds a `versions` array to `python-autodoc.json` / `ts-autodoc.json`. Each rebuild checks out the source repo at each tag (via `git worktree add`), regenerates the API reference per tag into `<outputDir>/<safeTag>/`, and aliases the default version at the un-versioned URL. Cheap, composable, no branches to maintain. The bundled `<VersionPicker>` component renders a topbar dropdown.
|
|
402
|
+
2. **`starlight-versions` plugin** — opinionated, archives the entire site (guides + API). Pick this only if guides drift between versions too. Pre-1.0; expect rough edges.
|
|
403
|
+
3. **Branch-per-version** — each major version is a git branch deployed to a subdomain, the main branch's host (Vercel/CF) rewrites `/v2/*` → that subdomain. Best when teams already maintain per-version branches.
|
|
404
|
+
4. **Single version (no versioning).** Default if the user is unsure. Easy to add versioning later.
|
|
405
|
+
|
|
406
|
+
Default the recommendation to **option 1** when the project has Python or TypeScript autodoc wired (Phases 4/5 ran). Default to **option 2** when the docs project has substantial hand-written guides and the user expects them to differ per version.
|
|
407
|
+
|
|
408
|
+
If the user picks option 1:
|
|
409
|
+
|
|
410
|
+
a. Surface up to the 5 most recent tags as candidates. Ask which to publish — let them deselect noisy point releases. Mark the most recent as `default: true` unless the user picks a different one (e.g. an LTS tag).
|
|
411
|
+
|
|
412
|
+
b. Write the `versions` array into the appropriate autodoc JSON config. Example shape:
|
|
413
|
+
|
|
414
|
+
```jsonc
|
|
415
|
+
{
|
|
416
|
+
"searchPath": "../../auditkit/src",
|
|
417
|
+
"modules": [...],
|
|
418
|
+
"outputDir": "src/content/docs/api",
|
|
419
|
+
"versions": [
|
|
420
|
+
{ "tag": "v0.4.0", "label": "0.4 (latest)", "default": true },
|
|
421
|
+
{ "tag": "v0.3.2", "label": "0.3" },
|
|
422
|
+
{ "tag": "v0.2.0", "label": "0.2 (legacy)" }
|
|
423
|
+
]
|
|
424
|
+
}
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
c. **No override needed.** The `abstractData()` plugin already overrides `SocialIcons` to render `<VersionPicker>` next to the existing chip and social links. As soon as the autodoc orchestrator emits per-version pages with `version:` frontmatter, the picker appears in the topbar automatically — no user-side wiring, no `versions` prop to maintain. The picker walks the docs collection at build time, dedupes by tag, picks up the `versionDefault: true` flag for the default version. The autodoc JSON is the single source of truth.
|
|
428
|
+
|
|
429
|
+
If the autodoc base path differs from the default `/api` (e.g. `outputDir: "src/content/docs/api/ts"` for TypeScript-only sites), pass `apiBase` to the plugin so the picker constructs the right URLs:
|
|
430
|
+
|
|
431
|
+
```js
|
|
432
|
+
starlight({
|
|
433
|
+
plugins: [
|
|
434
|
+
abstractData({
|
|
435
|
+
motion: 'calm',
|
|
436
|
+
apiBase: '/api/ts',
|
|
437
|
+
}),
|
|
438
|
+
],
|
|
439
|
+
})
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
d. **Verify the docs project's content schema accepts the version frontmatter fields.** Read `src/content.config.ts` and confirm the `docsSchema.extend` zod object includes:
|
|
443
|
+
|
|
444
|
+
```ts
|
|
445
|
+
version: z.string().optional(),
|
|
446
|
+
versionLabel: z.string().optional(),
|
|
447
|
+
versionDefault: z.boolean().optional(),
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
The `create-docs` template scaffold already ships with these. For projects upgraded via `bunx abstract-data-install-skills`, you'll need to add them — without these optional fields, Zod will reject the autodoc-emitted frontmatter and the build fails with `InvalidContentEntryDataError`.
|
|
451
|
+
|
|
452
|
+
e. Tell the user to run `bun run docs:python` (or `docs:ts`) to populate the per-version directories. The script handles the worktrees automatically.
|
|
453
|
+
|
|
454
|
+
f. **Optional curated override.** If the user wants to hide pre-release tags or reorder the dropdown, they can wire a user-level override of `SocialIcons` that imports `<VersionPicker>` and passes an explicit `versions` prop — that bypasses auto-discovery. Don't recommend this by default; auto-discovery keeps the autodoc JSON as the single source of truth.
|
|
455
|
+
|
|
456
|
+
If the user picks option 2 (`starlight-versions`):
|
|
457
|
+
|
|
458
|
+
- Install: `bun add starlight-versions`
|
|
459
|
+
- Add to `astro.config.mjs` plugins array
|
|
460
|
+
- Run the plugin's CLI to archive the current state
|
|
461
|
+
- Configure `starlight-versions.versions` to match the user's version list
|
|
462
|
+
- Note: this conflicts with option 1 — pick *one*.
|
|
463
|
+
|
|
464
|
+
If the user picks option 3 (branch-per-version):
|
|
465
|
+
|
|
466
|
+
- This is mostly a deployment-platform concern. Suggest the Knip pattern (Vercel rewrites) and link them at [webpro.nl/scraps/versioned-docs-with-starlight-and-vercel](https://webpro.nl/scraps/versioned-docs-with-starlight-and-vercel). Don't try to wire this yourself — too platform-specific.
|
|
467
|
+
|
|
468
|
+
If the user picks option 4 (none): skip silently, leave `versions` field absent from the autodoc config.
|
|
469
|
+
|
|
470
|
+
**Site version vs. API version** — they're different. The `version` chip in the theme's plugin call (e.g. `version: 'v1.0.0'`) is the *site's own* marketing version. The `versions` array in autodoc configs is the *documented API's* versions. A site might be at `v1.2.0` while documenting API `v0.4.0` — that's normal, don't conflate them.
|
|
471
|
+
|
|
472
|
+
### Phase 12 — Optional pre-commit hook (per-stack)
|
|
473
|
+
|
|
474
|
+
Fires only if Phase 4a (Python) or Phase 5a (TypeScript) found modules below the 80% coverage threshold.
|
|
475
|
+
|
|
476
|
+
**Python branch** — if Phase 4a found yellow/red modules, offer:
|
|
477
|
+
|
|
478
|
+
- Tool: `interrogate` (lightweight, no project changes beyond the hook entry).
|
|
479
|
+
- Config: append a `[tool.interrogate]` table to `pyproject.toml` setting `fail-under = 80`, `exclude = ["tests"]`, etc.
|
|
480
|
+
- `.pre-commit-config.yaml`: add the `econchick/interrogate` repo with the chosen revision.
|
|
481
|
+
|
|
482
|
+
**TypeScript branch** — if Phase 5a found yellow/red entry points, offer either:
|
|
483
|
+
|
|
484
|
+
- **Local script hook (preferred)**: a one-liner `pre-commit` config that runs the docs build script with `--validation.notDocumented` and fails the commit if any new warnings appear. No extra dependencies beyond `typedoc` (already a dev dep).
|
|
485
|
+
|
|
486
|
+
```yaml
|
|
487
|
+
# .pre-commit-config.yaml fragment
|
|
488
|
+
- repo: local
|
|
489
|
+
hooks:
|
|
490
|
+
- id: tsdoc-coverage
|
|
491
|
+
name: TSDoc coverage
|
|
492
|
+
entry: bunx typedoc --plugin typedoc-plugin-markdown --validation.notDocumented --treatValidationWarningsAsErrors true --emit none
|
|
493
|
+
language: system
|
|
494
|
+
types: [ts]
|
|
495
|
+
pass_filenames: false
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
- **`tsdoc-coverage` package** (if the user prefers a dedicated tool): npm install `tsdoc-coverage` as a dev dep and wire it as the hook entry instead. Threshold defaults to 80% to match the Python side.
|
|
499
|
+
|
|
500
|
+
In both stacks: show the user the exact config diff before writing. The pre-commit hook lives in the **source repo**, not the docs repo — extra caution since it's a different project.
|
|
501
|
+
|
|
502
|
+
### Phase 12.5 — Confirm `starlight-links-validator` is wired
|
|
503
|
+
|
|
504
|
+
The template ships with `starlight-links-validator` already installed and registered as a Starlight plugin. Verify both during this phase:
|
|
505
|
+
|
|
506
|
+
1. Read the docs project's `package.json` — confirm `starlight-links-validator` is in `dependencies` (or `devDependencies`).
|
|
507
|
+
2. Read `astro.config.mjs` — confirm the plugin is referenced inside `plugins: [...]` on the `starlight(...)` call.
|
|
508
|
+
3. Read the docs project's CI workflow (`.github/workflows/*.yml` or equivalent) — confirm `bun run build` (or `astro build`) runs on PRs. The links validator runs as part of the build, so a build-on-PR workflow is enough; no separate step needed.
|
|
509
|
+
|
|
510
|
+
If any of those three pieces are missing, surface the gap and offer to add it. The plugin's failure mode is "fail the build on any broken internal link" — exactly what you want for CI.
|
|
511
|
+
|
|
512
|
+
For migrating projects (running `bunx abstract-data-install-skills` rather than scaffolding via `bun create @abstractdata/docs`), the plugin will not be installed automatically. Tell the user:
|
|
513
|
+
|
|
514
|
+
```bash
|
|
515
|
+
bun add starlight-links-validator
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
then add `starlightLinksValidator()` to the `plugins` array in `astro.config.mjs`. Show the diff.
|
|
519
|
+
|
|
520
|
+
### Phase 13 — Summary
|
|
521
|
+
|
|
522
|
+
6–10 line markdown summary covering: detected stacks, what got wired up per stack, logo update, mode (motion/credit/version), files updated, generated counts (if Phase 11 ran), next steps.
|
|
523
|
+
|
|
524
|
+
## Idempotency
|
|
525
|
+
|
|
526
|
+
- Don't duplicate sidebar entries — check before adding.
|
|
527
|
+
- Don't append to `modules`/`entryPoints` arrays — replace cleanly.
|
|
528
|
+
- Don't add a second `abstractData(...)` call — update the existing one.
|
|
529
|
+
- Don't overwrite content under `src/content/docs/` (only `api/` pages, regenerated by the script).
|
|
530
|
+
- Don't add a second logo line — replace.
|
|
531
|
+
|
|
532
|
+
## Out of scope (this round)
|
|
533
|
+
|
|
534
|
+
- TanStack route detection auto-config (recipe-only)
|
|
535
|
+
- Next.js route map auto-config (recipe-only)
|
|
536
|
+
- Prisma schema-doc auto-config (recipe-only)
|
|
537
|
+
- Drizzle schema-doc auto-config (recipe-only — no mature tooling)
|
|
538
|
+
- README/CHANGELOG/ADR auto-import into the sidebar
|
|
539
|
+
|
|
540
|
+
## Files this skill reads / writes
|
|
541
|
+
|
|
542
|
+
**Reads (docs project):** `package.json`, `astro.config.mjs`, `src/assets/`.
|
|
543
|
+
**Reads (source project):** `pyproject.toml`, `setup.py`, source tree, `tsconfig.json`, `next.config.*`, dependency manifests, schema files, OpenAPI specs.
|
|
544
|
+
|
|
545
|
+
**Writes (docs project):** `scripts/python-autodoc.json`, `scripts/ts-autodoc.json`, `astro.config.mjs` (edits), `package.json` (scripts only).
|
|
546
|
+
|
|
547
|
+
**Writes (source project, with explicit pre-commit consent only):** `.pre-commit-config.yaml`, `pyproject.toml` (dev deps section), `requirements-dev.txt`, or `package.json` (TS dev deps for `tsdoc-coverage` if chosen).
|
|
548
|
+
|
|
549
|
+
## Notes for the agent
|
|
550
|
+
|
|
551
|
+
- Be conservative with edits. Show diffs in your reasoning before writing.
|
|
552
|
+
- Phase 12 modifies a different repo than the docs project — extra caution.
|
|
553
|
+
- For TypeScript: TypeDoc requires `typescript` AND `typedoc` AND `typedoc-plugin-markdown`. If any are missing, the orchestrator will tell the user via the script output. Don't try to install them yourself unless the user explicitly asks.
|
|
554
|
+
- For OpenAPI: prefer `@astrojs/starlight-openapi` (mature plugin) over building from scratch.
|
|
555
|
+
- Keep conversation tight: detection in 1–3 sentences, audit table 5–8 lines, questions one round at a time, summary 6–10 lines.
|