You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Implements new command to find files with no incoming references
- Scans all RST and YAML files to build complete reference map
- Identifies files not referenced by include, literalinclude, io-code-block, or toctree
- Supports --include-toctree flag to consider navigation links
- Supports --exclude pattern to skip certain paths
- Provides text, JSON, count-only, and paths-only output formats
- Includes comprehensive tests and documentation
- Useful for finding unused includes, unlinked pages, and legacy content
Find files that have no incoming references from other files. This command scans all RST and YAML files in a source directory to identify files that are not referenced by any include, literalinclude, io-code-block, or toctree directive.
522
+
523
+
**Use Cases:**
524
+
525
+
This command helps writers:
526
+
- Find unused include files that can be removed
527
+
- Identify documentation pages not linked in the navigation
528
+
- Discover legacy content that needs cleanup
529
+
- Maintain documentation hygiene by removing dead files
530
+
- Identify entry points (like index.rst) that are referenced externally
531
+
532
+
**Basic Usage:**
533
+
534
+
```bash
535
+
# Find orphaned files in a source directory
536
+
./audit-cli analyze orphaned-files ~/docs/source
537
+
538
+
# Include toctree references (consider navigation links)
-`--format <format>` - Output format: `text` (default) or `json`
560
+
-`-v, --verbose` - Show detailed information during scanning
561
+
-`-c, --count-only` - Only show the count of orphaned files
562
+
-`--paths-only` - Only show the file paths, one per line (useful for piping to other commands)
563
+
-`--include-toctree` - Include toctree references when determining orphaned status
564
+
-`--exclude <pattern>` - Exclude paths matching this glob pattern (e.g., `*/archive/*` or `*/deprecated/*`)
565
+
566
+
**Output:**
567
+
568
+
Text format shows:
569
+
- Source directory path
570
+
- Total files scanned
571
+
- Number of orphaned files
572
+
- List of orphaned files (relative paths)
573
+
- Helpful suggestions for what to do with orphaned files
574
+
575
+
JSON format provides:
576
+
```json
577
+
{
578
+
"source_dir": "/path/to/source",
579
+
"total_files": 150,
580
+
"total_orphaned": 12,
581
+
"orphaned_files": [
582
+
"unused-include.rst",
583
+
"legacy-page.rst",
584
+
"includes/old-fact.rst"
585
+
],
586
+
"included_toctree": false
587
+
}
588
+
```
589
+
590
+
**Exit Codes:**
591
+
592
+
-`0` - Success (whether orphaned files found or not)
593
+
-`1` - Error (invalid arguments, directory not found, etc.)
594
+
595
+
**Note:** By default, only content inclusion directives (include, literalinclude, io-code-block) are considered. Use `--include-toctree` to also consider toctree entries (navigation links) when determining orphaned status. Entry point files like `index.rst` will typically appear as orphaned since they're referenced externally by the build system.
0 commit comments