spec-generator-maintenance
Perform maintenance tasks for @markuplint/spec-generator: fix scraping breakages,
add ARIA versions, update the obsolete element list, and debug scraping issues.
Input
$ARGUMENTS specifies the task. Supported tasks:
| Task | Description |
|---|---|
fix-scraping <source> | Fix scraping breakage caused by upstream page changes |
add-aria-version <ver> | Add support for a new ARIA specification version |
add-obsolete <element> | Add an element to the obsolete list |
debug-element <name> | Debug scraping results for a specific element |
update-deps | Update dependencies and verify compatibility |
If omitted, defaults to fix-scraping.
Reference
Before executing any task, read docs/maintenance.md (or docs/maintenance.ja.md)
for the full guide. The recipes there are the source of truth for procedures.
Also read:
- •
docs/scraping.md-- Scraping targets, CSS selectors, and fragile points - •
docs/modules.md-- Module reference for all source files - •
ARCHITECTURE.md-- Package overview and data flow
Task: fix-scraping
Fix CSS selectors that have broken due to upstream page structure changes.
Step 1: Identify the scope
The <source> argument specifies which scraping target is affected:
| Source | Module | Upstream Site |
|---|---|---|
mdn | scraping.ts | MDN Web Docs element reference pages |
aria | aria.ts | W3C ARIA specification pages |
svg | svg.ts | MDN SVG element index page |
html-aria | aria.ts | W3C HTML-ARIA mapping page |
Step 2: Diagnose
- •Run
yarn up:genand check theindex.jsondiff:bashgit diff packages/@markuplint/html-spec/index.json
- •Identify which data is missing or incorrect
- •Open the affected upstream page in a browser
- •Compare the actual HTML structure with the CSS selectors in the module
- •Refer to
docs/scraping.mdfor the complete selector reference
Step 3: Fix
- •Update the CSS selectors in the identified module to match the new page structure
- •Build:
yarn build --scope @markuplint/spec-generator - •Regenerate:
yarn up:gen - •Verify the
index.jsondiff shows correct data restoration
Step 4: Test and commit
- •Run
yarn workspace @markuplint/html-spec run test - •Stage and commit both the selector fix and the regenerated
index.json
Task: add-aria-version
Add support for a new ARIA specification version. Follow recipe #2 in docs/maintenance.md.
- •Read
src/aria.tsto understand the current version handling - •Add the new version URL in
getARIASpecURLByVersion() - •Add the new version data fetching in
getAria() - •Cross-package: Update
ARIAVersiontype in@markuplint/ml-spec - •Build:
yarn build --scope @markuplint/spec-generator - •Regenerate:
yarn up:gen - •Verify the new version's data appears in
index.json - •Run tests:
yarn workspace @markuplint/html-spec run test
Task: add-obsolete
Add an element to the hardcoded obsolete list. Follow recipe #3 in docs/maintenance.md.
- •Read
src/html-elements.ts - •Add the element name to the
obsoleteListarray - •Build:
yarn build --scope @markuplint/spec-generator - •Regenerate:
yarn up:gen - •Verify the element appears in
index.jsonwith"obsolete": true - •Run tests:
yarn workspace @markuplint/html-spec run test
Task: debug-element
Debug the scraping results for a specific element to understand what data is being extracted.
- •Read
src/scraping.tsandsrc/html-elements.ts - •Construct the MDN URL for the element:
- •HTML:
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/<name> - •SVG:
https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/<name> - •Heading elements (
h1-h6): useHeading_Elementsas the name
- •HTML:
- •Use WebFetch to inspect the MDN page structure
- •Compare the page structure with the CSS selectors in
scraping.ts - •Report findings: which selectors match, which data is extracted, and any discrepancies
Task: update-deps
Update package dependencies and verify compatibility.
- •Read
package.jsonfor current dependency versions - •Check for available updates
- •For
cheerioupdates:- •Review the changelog for breaking API changes
- •Refer to recipe #5 in
docs/maintenance.mdfor the API surface used
- •For
@markuplint/ml-specupdates:- •Check for type changes that affect this package
- •Refer to recipe #4 in
docs/maintenance.md
- •Update dependencies
- •Build:
yarn build --scope @markuplint/spec-generator - •Regenerate:
yarn up:gen - •Run tests:
yarn workspace @markuplint/html-spec run test - •Review
index.jsondiff for unexpected changes
Rules
- •Always build after source changes. Run
yarn build --scope @markuplint/spec-generatorbeforeyarn up:gen. - •Always check the index.json diff. The diff is the primary way to verify scraping correctness.
- •Use the actual page structure as the source of truth. When selectors break, inspect the live page -- do not guess.
- •Cross-package changes may be required. ARIA version additions and type changes often affect
@markuplint/ml-spec. - •Failed fetches are cached as empty strings. If a URL fails during
yarn up:gen, the data will be empty. Re-running will re-fetch.