Overview
Thedex doctor command scans entry folders to detect drift, validation errors, and health issues. It can run in interactive mode (TTY) with repair capabilities or in non-interactive mode for CI/CD pipelines.
Usage
Modes
Interactive Mode (TTY)
When running in a terminal with TTY support:- Displays interactive screen with entry health reports
- Allows filtering and navigation
- Provides repair functionality for detected issues
- Shows detailed diagnostics per entry
Non-Interactive Mode
When running in non-TTY environment or piped:- Prints per-entry report to stdout
- Exits with non-zero status code if errors are detected
- Suitable for CI/CD validation gates
What Doctor Checks
File Structure
- Presence of
entry.json - Presence of
manifest.json - Presence of
description.txt - Presence of
index.html
Schema Validation
- Entry schema compliance
- Manifest schema compliance
- Sidebar config validation
- Format key validation
Content Integrity
- HTML Drift Detection: Compares existing
index.htmlwith deterministic regeneration - Manifest Normalization: Detects if manifest needs normalization
- Auth Configuration: Verifies auth trio scripts are present
- Legacy Code: Flags legacy Auth0 blocks
Download Manifest
- Validates Drive IDs don’t contain URLs or paths
- Checks for empty buckets
- Verifies populated download IDs for selected buckets
Metadata
- Tags validation against catalog
- Sample length presence check
- Unknown tag detection
Interactive TUI Keybindings
Up/Down- Select entry report- Type to filter slugs
Ctrl+S- Repair selected entryEsc- Back to dashboard
Repair Functionality
When running in interactive mode, pressingCtrl+S on a selected entry triggers repair:
- Normalizes manifest if needed
- Migrates description if missing
- Regenerates
index.htmlfrom canonical template - Updates lifecycle timestamps
- Verifies sanitized HTML output
Check Indicators
Errors (❌)
entry.json missing- Critical: entry cannot be processedschema/parse invalid- Entry or manifest fails validation
Warnings (⚠)
manifest.json missing- Can be repaired with skeletondescription.txt missing- Can be migrated from entry.jsonindex.html missing- Can be regeneratedSTALE HTML- index.html differs from deterministic regenerationauth trio missing- Required auth scripts not foundlegacy Auth0 blocks- Old auth code still presentmanifest normalization drift- Manifest needs normalizationbucket X has no populated download ids- Empty bucket detectedlooks like URL/path, expected plain drive id- Invalid Drive ID formatunknown tags- Tags not in catalogmetadata.sampleLength missing- Missing sample length field
Output Example
Interactive Mode
Non-Interactive Mode
Exit Codes
0- All entries healthy1- One or more entries have errors
Examples
Interactive Scan and Repair
CI/CD Validation
In Verification Workflow
Common Issues and Fixes
Stale HTML
Symptom:STALE HTML: differs from deterministic regeneration
Fix: Use Ctrl+S in interactive mode to regenerate, or run dex update for the entry
Invalid Drive IDs
Symptom:looks like URL/path, expected plain drive id
Fix: Edit manifest.json to use plain Drive IDs (e.g., 1aB2cD3eF4gH5) instead of full URLs
Missing Files
Symptom:manifest.json missing, description.txt missing, index.html missing
Fix: Use repair function (Ctrl+S) to auto-generate missing files
Unknown Tags
Symptom:unknown tags: experimental, noise
Fix: Either remove tags from entry metadata or add them to the tags catalog
Related Commands
dex init
Create a new entry
dex update
Edit an existing entry
dex entry audit
Runtime and inventory audit
Entry Validation
Production entry validation workflow
Notes
- Doctor scans all subdirectories in
./entriesby default - Repair is a safe operation that preserves entry data
- The command uses the canonical template for HTML regeneration
- Sanitization checks are enforced during repair
- Doctor is included in preflight checks before deployment