This directory contains scripts that automatically update the website's command documentation from the latest dbatools PowerShell module releases.
The pipeline automatically:
- Downloads the latest dbatools command index
- Transforms it to the website's format with categories and metadata
- Generates individual markdown pages for each command
- Enriches the data with full-text search content
- Applies popularity rankings
- Verifies URLs are correct
Purpose: Downloads and transforms dbatools-index.json into the website's commands.json format
What it does:
- Downloads
dbatools-index.jsonfrom the dbatools GitHub repository - Transforms 697 commands from source format to website format
- Derives categories using intelligent pattern matching:
- Verb-based (Copy/Export → Migration, Backup/Restore → Backup & Restore)
- Tag-based (agent → Agent & Jobs, certificate/encryption/login → Security)
- Domain-based (CPU/Memory → Performance, Replica → Advanced Features)
- Default fallback → Utilities
- Extracts verb from command name (e.g., "Add" from "Add-DbaAgDatabase")
- Generates url field as
/{CommandName} - Initializes popular (false) and popularityRank (0) fields
- Adds synopsis from source data
- Creates placeholder for fullContent (filled by next script)
Output: static/commands.json with 697 commands
Category Distribution (expected):
- Utilities: ~46%
- Security: ~10%
- Migration: ~9%
- Performance: ~7%
- Advanced Features: ~6%
- Agent & Jobs: ~6%
- Server Management: ~5%
- Backup & Restore: ~4%
- Database Operations: ~4%
- Data Operations: ~1%
Purpose: Creates individual Hugo markdown files for each command
What it does:
- Downloads
dbatools-index.jsonagain (uses same source) - Generates 697 markdown files in
content/commands/ - Each file contains:
- YAML front matter (title, slug, date, author, synopsis, tags, sourceUrl)
- Beautiful header with GitHub link
- Synopsis, Description, Syntax sections
- Examples with copy-able code blocks
- Parameter tables (Required and Optional)
Output: 697 files in content/commands/*.md
Purpose: Adds full-text search content to commands.json
What it does:
- Reads all markdown files from
content/commands/ - Extracts and cleans text content (strips HTML, markdown formatting)
- Adds fullContent field to each command in
commands.json - Updates synopsis if found in markdown front matter
- Copies enriched file to
public/commands.json
Output: Enhanced static/commands.json with fullContent for search
Purpose: Applies popularity rankings from analytics data
What it does:
- Loads
rankings.txt(680 commands ranked by page views) - Applies popularityRank to all ranked commands
- Sets popular: true for top 50 commands
- Falls back to hardcoded top 50 if rankings.txt is missing
Output: static/commands.json with popularity data
Purpose: Ensures all command URLs are correct
What it does:
- Verifies URLs are in format
/{CommandName} - Fixes any old-format URLs (docs.dbatools.io or /commands/)
- Validates consistency
Output: static/commands.json with corrected URLs
The complete pipeline runs automatically in .github/workflows/deploy.yml:
- name: Transform dbatools index to commands.json
shell: pwsh
run: ./scripts/transform-dbatools-index.ps1
- name: Generate command documentation pages
shell: pwsh
run: ./scripts/generate-command-pages.ps1
- name: Enrich commands.json with full content
shell: pwsh
run: ./scripts/enrich-commands-json.ps1
- name: Update popular commands with rankings
shell: pwsh
run: ./scripts/update-popular-commands.ps1
- name: Ensure commands URLs are correct
shell: pwsh
run: ./scripts/update-commands-urls.ps1
- name: Build Hugo site
run: hugo --minifyTo update commands locally:
# Run the complete pipeline
cd c:\github\web\scripts
# Step 1: Transform source data
.\transform-dbatools-index.ps1
# Step 2: Generate markdown pages
.\generate-command-pages.ps1
# Step 3: Enrich with full content
.\enrich-commands-json.ps1
# Step 4: Apply popularity rankings
.\update-popular-commands.ps1
# Step 5: Verify URLs
.\update-commands-urls.ps1
# Build the site
cd ..
hugo serve-
Input:
https://raw.githubusercontent.com/dataplat/dbatools/master/bin/dbatools-index.json- Source of truth from dbatools repository
- Currently contains 697 commands
-
Output:
static/commands.json- Website's command database
- Used by
/commandspage JavaScript - Contains all metadata for search, filtering, and display
-
Reference:
rankings.txt- Popularity rankings for 680 commands
- Based on actual page view analytics
- Top 50 marked as "popular" on the site
{
"Name": "Add-DbaAgDatabase",
"CommandName": "Add-DbaAgDatabase",
"Description": "...",
"Tags": ["AG", "HA"],
"Synopsis": "...",
"Author": "...",
"Availability": "...",
"Links": "...",
"Examples": "...",
"Params": [...],
"Syntax": "..."
}{
"name": "Add-DbaAgDatabase",
"description": "Adds databases to an Availability Group",
"category": "Database Operations",
"tags": ["add", "database", "availability-groups"],
"verb": "Add",
"popular": true,
"url": "/Add-DbaAgDatabase",
"popularityRank": 15,
"synopsis": "Adds databases to an Availability Group...",
"fullContent": "Add-DbaAgDatabase View Source..."
}The transformation script uses this priority order:
-
Verb-based (highest priority):
Copy-*orExport-*→ Migration (98% accuracy)Backup-*orRestore-*→ Backup & Restore
-
Tag-based (second priority):
agenttag → Agent & Jobscertificate,encryption,login,permissiontags → Securitybackuptag → Backup & Restoreinstancetag → Server Managementdatabasetag → Database Operationstabletag → Data Operations
-
Domain/Noun-based (requires SQL knowledge):
- Performance keywords (CPU, Memory, Wait, Latch, Plan, Trace) → Performance
- Replication nouns (Endpoint, Replica, Replication, Hadr) → Advanced Features
- Data operations (DataGenerator, DataMasking, TableData) → Data Operations
-
Default fallback:
- Everything else → Utilities
- Check
static/commands.jsonexists and has 697 commands - Verify JSON structure matches expected format
- Run
enrich-commands-json.ps1to ensure fullContent is present - Check browser console for JavaScript errors
- Review category assignment logic in
transform-dbatools-index.ps1 - Check command's tags and verb in source data
- Update categorization rules if needed
- Re-run transformation script
- Verify
rankings.txtexists in root directory - Check format:
@{ Name = "CommandName"; Rank = 1 } - Run
update-popular-commands.ps1manually - Falls back to top 50 hardcoded list if file missing
To update popularity rankings:
- Export analytics data for
/commands/*pages - Format as PowerShell hashtable array in
rankings.txt - Push to repository
- GitHub Actions will apply on next deployment
- Update
Get-CommandCategoryfunction intransform-dbatools-index.ps1 - Add new pattern matching rules
- Test with sample commands
- Update documentation
- Edit
generate-command-pages.ps1to change markdown template - Adjust
enrich-commands-json.ps1if changing what's extracted - Test locally before deploying
✅ Fully automated - No manual JSON updates needed ✅ Always current - Pulls latest 697 commands on every deployment ✅ Intelligent categorization - 98% accuracy for major categories ✅ Complete rankings - All 680 commands ranked, not just top 50 ✅ No data loss - Preserves all command metadata ✅ Fast pipeline - Entire process runs in under 2 minutes ✅ Error handling - Graceful fallbacks if data sources unavailable
- Category analysis:
CATEGORY_ANALYSIS.md(if exists) - Source data: https://github.com/dataplat/dbatools/blob/master/bin/dbatools-index.json
- Website commands page: https://dbatools.io/commands
- dbatools documentation: https://docs.dbatools.io