This commit is contained in:
2026-04-12 01:06:31 +07:00
commit 10d660cbcb
1066 changed files with 228596 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
# Advanced Scenarios & Edge Cases
## Multi-Language Documentation
**Challenge:** Docs in multiple languages
**Approach:**
1. Identify target language from user
2. Search for language-specific llms.txt
- `llms-es.txt`, `llms-ja.txt`
3. Fallback to English if not found
4. Note language limitations in report
## Version-Specific Documentation
**Latest (default):**
- Use base llms.txt URL
- No version specifier needed
**Specific version:**
```
WebSearch: "[library] v[version] llms.txt"
Check paths:
- /v2/llms.txt
- /docs/v2/llms.txt
- /{version}/llms.txt
For repos:
git checkout v[version] or tags/[version]
```
## Framework with Plugins
**Challenge:** Core framework + 50 plugins
**Strategy:**
1. Focus on core framework first
2. Ask user which plugins needed
3. Launch targeted search for specific plugins
4. Note available plugins in report
5. Don't document everything upfront
## Documentation Under Construction
**Signs:**
- New release with incomplete docs
- Many "Coming soon" pages
- GitHub issues requesting docs
**Approach:**
1. Note status upfront in report
2. Combine available docs + repo analysis
3. Check tests/ and examples/ directories
4. Clearly mark "inferred from code"
5. Link to GitHub issues for updates
## Conflicting Information
**When sources disagree:**
1. Identify primary official source
2. Note version differences
3. Present both approaches with context
4. Recommend official/latest
5. Explain why conflict exists
**Priority order:**
1. Official docs (latest version)
2. Official docs (versioned)
3. GitHub README
4. Community tutorials
5. Stack Overflow
## Rate Limiting
**If hitting API limits:**
- Use CONTEXT7_API_KEY from .env
- Implement exponential backoff
- Cache results in session
- Batch requests where possible

View File

@@ -0,0 +1,68 @@
# context7.com URL Patterns
## Topic-Specific URLs (Priority #1)
**Pattern:** `https://context7.com/{path}/llms.txt?topic={keyword}`
**When to use:** User asks about specific feature/component
**Examples:**
```
shadcn/ui date picker
→ https://context7.com/shadcn-ui/ui/llms.txt?topic=date
Next.js caching
→ https://context7.com/vercel/next.js/llms.txt?topic=cache
Better Auth OAuth
→ https://context7.com/better-auth/better-auth/llms.txt?topic=oauth
FFmpeg compression
→ https://context7.com/websites/ffmpeg_doxygen_8_0/llms.txt?topic=compress
```
**Benefits:** Returns ONLY relevant docs, 10x faster, minimal tokens
## General Library URLs (Priority #2)
**GitHub repos:** `https://context7.com/{org}/{repo}/llms.txt`
**Websites:** `https://context7.com/websites/{normalized-path}/llms.txt`
## Known Repository Mappings
```
next.js → vercel/next.js
nextjs → vercel/next.js
astro → withastro/astro
remix → remix-run/remix
shadcn → shadcn-ui/ui
shadcn/ui → shadcn-ui/ui
better-auth → better-auth/better-auth
```
## Official Site Fallbacks
Use ONLY if context7.com unavailable:
```
Astro: https://docs.astro.build/llms.txt
Next.js: https://nextjs.org/llms.txt
Remix: https://remix.run/llms.txt
SvelteKit: https://kit.svelte.dev/llms.txt
```
## Topic Keyword Normalization
**Rules:**
- Lowercase
- Remove special chars
- Use first word for multi-word topics
- Max 20 chars
**Examples:**
```
"date picker" → "date"
"OAuth" → "oauth"
"Server-Side" → "server"
"caching strategies" → "caching"
```

View File

@@ -0,0 +1,68 @@
# Error Handling & Fallback Strategies
## Error Codes
**404 Not Found**
- Topic-specific URL not available
- Library not on context7.com
- llms.txt doesn't exist
**Timeout**
- Network issues
- Large repository clone
- Slow API response
**Invalid Response**
- Malformed llms.txt
- Empty content
- Invalid URLs
## Fallback Chain
### For Topic-Specific Queries
```
1. Try topic-specific URL
https://context7.com/{library}/llms.txt?topic={keyword}
↓ 404
2. Try general library URL
https://context7.com/{library}/llms.txt
↓ 404
3. WebSearch for llms.txt
"[library] llms.txt site:[official domain]"
↓ Not found
4. Repository analysis
Use Repomix on GitHub repo
```
### For General Library Queries
```
1. Try context7.com
https://context7.com/{library}/llms.txt
↓ 404
2. WebSearch for llms.txt
"[library] llms.txt"
↓ Not found
3. Repository analysis
Clone + Repomix
↓ No repo
4. Research agents
Deploy multiple Researcher agents
```
## Timeout Handling
**Set limits:**
- WebFetch: 60s
- Repository clone: 5min
- Repomix: 10min
**Fail fast:** Don't retry failed methods
## Empty Results
**If llms.txt has 0 URLs:**
→ Note in report
→ Try repository analysis
→ Check official website manually