11# Claude Code Documentation Mirror - Enhanced Edition
22
3- This repository contains local copies of Claude Code documentation from https://docs.anthropic.com/en/docs/claude-code/
4-
5- The docs are periodically updated via GitHub Actions.
3+ > ** ⛔ CRITICAL: UPSTREAM ISOLATION ⛔**
4+ >
5+ > ** This repository is COMPLETELY INDEPENDENT. Do NOT:**
6+ > - Push to, pull from, or sync with the upstream repo (ericbuess/claude-code-docs)
7+ > - Create PRs to the upstream repo
8+ > - Add upstream as a remote
9+ > - Reference upstream in any git operations
10+ >
11+ > ** All git operations must target ` origin ` (costiash/claude-code-docs) ONLY.**
12+
13+ This repository contains local copies of Claude documentation from multiple Anthropic sources:
14+ - ** Platform docs** : https://platform.claude.com (API, guides, Agent SDK, etc.)
15+ - ** Claude Code docs** : https://code.claude.com/docs (CLI-specific documentation)
16+
17+ The docs are periodically updated via GitHub Actions with safeguards to prevent mass deletion.
618
719## Architecture: Single Installation with Optional Python Features
820
921This repository uses a ** graceful degradation** approach:
1022
1123** Installation** (always the same):
12- - 273 documentation paths tracked in manifest
13- - ~ 266-270 files downloaded (varies based on fetch success)
24+ - 573 documentation paths tracked in manifest (6 categories)
25+ - 571 files downloaded
1426- Python scripts for enhanced features
15- - Full test suite and GitHub workflows
27+ - Full test suite (294 tests) and GitHub workflows
1628
1729** Runtime Features** (Python-dependent):
1830- ** Without Python 3.9+** : Basic documentation reading via shell scripts
@@ -383,36 +395,53 @@ When Python 3.9+ is installed, these additional capabilities are available:
383395- ** Full-text search** : ` --search "keyword" ` searches across all documentation content
384396- ** Category filtering** : ` --category api ` lists paths in specific categories
385397- ** Path validation** : ` --validate ` checks documentation integrity
386- - ** Active documentation** : Access to 273 active paths across 7 categories:
387- - Core Documentation (80 paths, 29.3% )
388- - API Reference (79 paths, 28.9 %)
389- - Prompt Library (65 paths, 23.8 %)
390- - Claude Code (45 paths, 16.5 %)
398+ - ** Active documentation** : Access to 573 paths across 6 categories:
399+ - API Reference (377 paths, 65.8%) - Includes multi-language SDK docs (Python, TypeScript, Go, Java, Kotlin, Ruby )
400+ - Core Documentation (82 paths, 14.3 %)
401+ - Prompt Library (65 paths, 11.3 %)
402+ - Claude Code (46 paths, 8.0 %)
391403 - Release Notes (2 paths)
392404 - Resources (1 path)
393- - Uncategorized (1 path)
394405
395406See ` enhancements/ ` directory for comprehensive feature documentation and examples.
396407
397408## Repository Structure
398409
399410```
400411/
401- ├── docs/ # ~266-270 documentation files (.md format)
412+ ├── docs/ # 571 documentation files (.md format)
402413│ ├── docs_manifest.json # File tracking manifest
403414│ └── .search_index.json # Full-text search index (Python-generated)
404415├── scripts/
405416│ ├── claude-docs-helper.sh # Main helper (feature detection)
406- │ ├── fetch_claude_docs.py # Documentation fetcher with auto-regeneration
407- │ ├── lookup_paths.py # Search & validation (Python)
408- │ └── build_search_index.py # Index builder (Python)
409- ├── paths_manifest.json # Active paths manifest (273 paths tracked)
417+ │ ├── fetch_claude_docs.py # Thin wrapper for fetcher package
418+ │ ├── lookup_paths.py # Thin wrapper for lookup package
419+ │ ├── build_search_index.py # Index builder (Python)
420+ │ ├── fetcher/ # Documentation fetching package
421+ │ │ ├── __init__.py # Package exports
422+ │ │ ├── config.py # Constants and safety thresholds
423+ │ │ ├── manifest.py # Manifest file operations
424+ │ │ ├── paths.py # Path conversion and categorization
425+ │ │ ├── sitemap.py # Sitemap discovery and parsing
426+ │ │ ├── content.py # Content fetching and validation
427+ │ │ ├── safeguards.py # Safety checks (deletion prevention)
428+ │ │ └── cli.py # Main entry point
429+ │ └── lookup/ # Search and validation package
430+ │ ├── __init__.py # Package exports
431+ │ ├── config.py # Configuration constants
432+ │ ├── manifest.py # Manifest loading utilities
433+ │ ├── search.py # Search functionality
434+ │ ├── validation.py # Path validation
435+ │ ├── formatting.py # Output formatting
436+ │ └── cli.py # Main entry point
437+ ├── paths_manifest.json # Active paths manifest (573 paths, 6 categories)
438+ ├── archive/ # Archived/deprecated scripts (git-ignored)
410439├── enhancements/ # Feature documentation
411440│ ├── README.md # Overview
412441│ ├── FEATURES.md # Technical specs
413442│ ├── CAPABILITIES.md # Detailed capabilities
414443│ └── EXAMPLES.md # Usage examples
415- ├── tests/ # Test suite (620 tests, 618 passing)
444+ ├── tests/ # Test suite (294 tests, 294 passing)
416445├── install.sh # Installation script
417446└── CLAUDE.md # This file (AI context)
418447
@@ -430,15 +459,48 @@ When working on this repository:
430459@uninstall .sh - Clean removal
431460
432461### Python Features
433- @scripts /fetch_claude_docs.py - Documentation fetcher with auto-regeneration
434- @scripts /lookup_paths.py - Search & validation
462+ @scripts /fetch_claude_docs.py - Thin wrapper for fetcher package (backwards compatible)
463+ @scripts /lookup_paths.py - Thin wrapper for lookup package (backwards compatible)
464+ @scripts/fetcher / - Documentation fetching package (8 modules)
465+ @scripts/lookup / - Search & validation package (7 modules)
435466@scripts /build_search_index.py - Full-text search indexing
436- @paths_manifest.json - Active paths manifest (273 paths tracked )
437- @tests / - Test suite (620 tests)
467+ @paths_manifest.json - Active paths manifest (573 paths, 6 categories )
468+ @tests / - Test suite (294 tests)
438469
439470### Automation
440471@.github/workflows/ - Auto-update workflows (runs every 3 hours)
441472
473+ ## Documentation Deletion Safeguards
474+
475+ The automated sync system includes multiple safeguards to prevent catastrophic documentation loss. These were implemented after a critical bug where 80%+ of documentation was deleted due to broken sitemap URLs.
476+
477+ ### Safety Thresholds (in ` scripts/fetcher/config.py ` )
478+
479+ | Constant | Value | Purpose |
480+ | ----------| -------| ---------|
481+ | ` MIN_DISCOVERY_THRESHOLD ` | 200 | Minimum paths that must be discovered from sitemaps |
482+ | ` MAX_DELETION_PERCENT ` | 10 | Maximum percentage of files that can be deleted in one sync |
483+ | ` MIN_EXPECTED_FILES ` | 250 | Minimum files that must remain after sync |
484+
485+ ### How Safeguards Work
486+
487+ 1 . ** Discovery Validation** : Before fetching, validates that sitemap discovery found enough paths
488+ 2 . ** Deletion Limiting** : ` cleanup_old_files() ` refuses to delete more than 10% of existing files
489+ 3 . ** File Count Validation** : Refuses to proceed if result would have fewer than 250 files
490+ 4 . ** Workflow Validation** : GitHub Actions validates sync success before committing
491+
492+ ### Sitemap Sources
493+
494+ Documentation is discovered from two sitemaps:
495+ - ` https://platform.claude.com/sitemap.xml ` - Platform documentation (API, guides, etc.)
496+ - ` https://code.claude.com/docs/sitemap.xml ` - Claude Code CLI documentation
497+
498+ ### Filename Conventions
499+
500+ Files are named based on their source:
501+ - Platform docs: ` en__docs__section__page.md ` (double underscore for path separators)
502+ - Claude Code docs: ` docs__en__page.md ` (prefixed with ` docs__ ` )
503+
442504## Working on This Repository
443505
444506** Critical Rule** : Changes must maintain graceful degradation - work with AND without Python.
@@ -463,7 +525,7 @@ python3 scripts/lookup_paths.py --search "mcp"
463525pytest tests/ -v
464526
465527# Run full test suite
466- pytest tests/ -q # Should see: 598 passed, 2 skipped
528+ pytest tests/ -q # Should see: 294 passed, 2 skipped
467529```
468530
469531## Upstream Compatibility
0 commit comments