Skip to content

Commit 8f1fd99

Browse files
ericyangpanclaude
andcommitted
docs: overhaul and restructure project documentation
- Update README with current multilingual support (12 languages) and deployment details - Rewrite FETCH_GITHUB_STARS.md with comprehensive API reference and usage guide - Expand MANIFEST_I18N.md with full type documentation, examples, and best practices - Refactor METADATA_OPTIMIZATION.md with improved schema system documentation - Update related schema and SEO documentation files πŸ€– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 027312e commit 8f1fd99

File tree

8 files changed

+1910
-2119
lines changed

8 files changed

+1910
-2119
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ AI Coding Stack is a comprehensive directory and community-maintained metadata r
2828
- **Curated Collections**: Hand-picked tool collections for specific use cases
2929
- **Community-Driven**: Open-source metadata maintained by the developer community
3030
- **Always Updated**: Latest version tracking and up-to-date information
31-
- **Multilingual**: Support for English, German, Simplified Chinese, and Korean (more coming soon)
31+
- **Multilingual**: Support for 12 languages including English, German, Simplified & Traditional Chinese, Korean, Spanish, French, Indonesian, Japanese, Portuguese, Russian, and Turkish
3232

3333
## Data Structure
3434

@@ -126,7 +126,7 @@ All manifest files are automatically validated against JSON schemas. Make sure y
126126
- **Styling**: Tailwind CSS 4
127127
- **Internationalization**: next-intl
128128
- **Content**: MDX for documentation
129-
- **Deployment**: Cloudflare Workers
129+
- **Deployment**: Cloudflare Workers (via OpenNext for Cloudflare)
130130

131131
## Contributing
132132

β€Ždocs/FETCH_GITHUB_STARS.mdβ€Ž

Lines changed: 185 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,212 @@
11
# GitHub Stars Fetcher
22

3-
This script fetches GitHub star counts for all projects in the manifest files and updates the `githubStars` field.
3+
**Last Updated:** January 6, 2026
44

5-
## Features
5+
This document describes the GitHub stars fetching system for AI Coding Stack.
66

7-
- Fetches star counts from GitHub API for all projects with GitHub URLs
8-
- Converts star counts to 'k' format (e.g., 1.5k, 23.4k)
9-
- Handles different JSON structures (direct `githubUrl` field vs nested `communityUrls.github`)
10-
- Supports GitHub authentication to avoid rate limits
11-
- Automatic retry delay to avoid hitting API rate limits
7+
---
128

13-
## Prerequisites
9+
## Overview
1410

15-
```bash
16-
npm install
17-
# or if you only need the built-in Node.js modules, no installation needed
11+
The GitHub Stars Fetcher fetches star counts from the GitHub API for all projects in the manifest files and creates a centralized `github-stars.json` data file.
12+
13+
**Implementation**: `scripts/fetch/fetch-github-stars.mjs`
14+
**Output**: `manifests/github-stars.json`
15+
16+
---
17+
18+
## Schema
19+
20+
The stars data follows `manifests/$schemas/github-stars.schema.json`:
21+
22+
```typescript
23+
interface ManifestGitHubStars {
24+
extensions: { [productId: string]: number | null }
25+
clis: { [productId: string]: number | null }
26+
ides: { [productId: string]: number | null }
27+
}
1828
```
1929

30+
---
31+
2032
## Usage
2133

22-
### Using npm script (Recommended)
34+
### Fetch Stars with GitHub Token (Recommended)
2335

24-
#### Without GitHub Token (Rate Limited)
2536
```bash
26-
npm run fetch:github-stars
37+
GITHUB_TOKEN=your_github_token_here npm run generate
2738
```
2839

29-
⚠️ **Warning**: Without authentication, you're limited to 60 requests per hour.
40+
### Fetch Stars Without Token (Rate Limited)
3041

31-
#### With GitHub Token (Recommended)
3242
```bash
33-
GITHUB_TOKEN=your_github_token_here npm run fetch:github-stars
43+
npm run generate
3444
```
3545

36-
With authentication, you get 5,000 requests per hour.
46+
### Direct Script Execution
3747

38-
### Using Node.js directly
39-
40-
#### Without GitHub Token
4148
```bash
4249
node scripts/fetch/index.mjs github-stars
4350
```
4451

45-
#### With GitHub Token
46-
```bash
47-
GITHUB_TOKEN=your_github_token_here node scripts/fetch/index.mjs github-stars
48-
```
52+
---
4953

5054
## Getting a GitHub Token
5155

5256
1. Go to https://github.com/settings/tokens
53-
2. Click "Generate new token" β†’ "Generate new token (classic)"
57+
2. Click **Generate new token** β†’ **Generate new token (classic)**
5458
3. Give it a name (e.g., "acs-stars-fetcher")
55-
4. Select scopes: Only need `public_repo` (or no scopes for public repos)
56-
5. Click "Generate token"
57-
6. Copy the token and use it in the command above
59+
4. Scopes: `public_repo` (or none for public repos only)
60+
5. Click **Generate token**
61+
6. Copy the token and use it as `GITHUB_TOKEN` environment variable
62+
63+
---
64+
65+
## Rate Limits
66+
67+
| Authentication | Requests | Time Period |
68+
|----------------|----------|-------------|
69+
| With token | 5,000 | 1 hour |
70+
| Without token | 60 | 1 hour |
71+
72+
**Recommendation**: Always use a GitHub token to avoid rate limiting.
73+
74+
---
75+
76+
## How It Works
77+
78+
### 1. Data Sources
5879

59-
## What It Does
80+
The script fetches GitHub URLs from these files:
6081

61-
The script processes these files:
62-
- `manifests/terminals.json` (uses `communityUrls.github` field)
63-
- `manifests/extensions.json` (uses `communityUrls.github` field)
64-
- `manifests/ides.json` (uses `communityUrls.github` field)
65-
- `manifests/clis.json` (uses `communityUrls.github` field)
66-
- `manifests/providers.json` (uses `communityUrls.github` field)
67-
- `manifests/vendors.json` (uses `communityUrls.github` field)
82+
| Category | File | URL Field |
83+
|----------|------|-----------|
84+
| Extensions | `manifests/extensions/*.json` | `communityUrls.github` |
85+
| CLIs | `manifests/clis/*.json` | `communityUrls.github` |
86+
| IDEs | `manifests/ides/*.json` | `communityUrls.github` |
87+
| Models | `manifests/models/*.json` | `communityUrls.github` |
88+
89+
### 2. Processing Steps
6890

6991
For each project:
70-
1. Extracts the GitHub URL
71-
2. Parses owner/repo from the URL
72-
3. Fetches star count from GitHub API
73-
4. Converts to 'k' format (1 decimal place)
74-
5. Updates the `githubStars` field
7592

76-
## Output Format
93+
1. Extract GitHub URL from `communityUrls.github` field
94+
2. Parse owner/repo from URL (e.g., `microsoft/playwright`)
95+
3. Fetch star count from GitHub API: `GET /repos/:owner/:repo/stargazers`
96+
4. Store raw star count (number)
97+
5. Write to `manifests/github-stars.json`
98+
99+
### 3. Output Format
100+
101+
```json
102+
{
103+
"extensions": {
104+
"playwright": 90450,
105+
"context7": 2150,
106+
"claude-code": 5420
107+
},
108+
"clis": {
109+
"github-copilot-cli": 3450,
110+
"codex-cli": 1230
111+
},
112+
"ides": {
113+
"cursor": 42000
114+
}
115+
}
116+
```
117+
118+
---
119+
120+
## Display Format
121+
122+
When displaying stars on the site, they are formatted with a helper function:
123+
124+
```typescript
125+
// Formats: 42000 β†’ "42k", 1500 β†’ "1.5k", 150 β†’ "150"
126+
function formatStars(stars: number | null): string
127+
```
128+
129+
This is separate from the stored format (raw numbers).
130+
131+
---
132+
133+
## Usage in Components
134+
135+
### Import Stars Data
136+
137+
```typescript
138+
import { githubStars } from '@/lib/generated/github-stars'
139+
140+
// Get stars for an IDE
141+
const cursorStars = githubStars.ides['cursor'] // Returns number or null
142+
143+
// Display formatted
144+
const displayStars = formatStars(cursorStars) // "42k"
145+
```
146+
147+
### ProductHero Component
77148

78-
The `githubStars` field will be populated with numbers in 'k' format:
79-
- `1500` stars β†’ `1.5`
80-
- `23456` stars β†’ `23.5`
81-
- `123` stars β†’ `0.1`
149+
```typescript
150+
import { githubStars } from '@/lib/generated/github-stars'
151+
152+
<ProductHero
153+
name={ide.name}
154+
description={ide.description}
155+
githubStars={githubStars.ides[ide.id] ?? 0}
156+
/>
157+
```
158+
159+
---
160+
161+
## Files Involved
162+
163+
| Category | File | Purpose |
164+
|----------|------|---------|
165+
| Script | `scripts/fetch/fetch-github-stars.mjs` | Fetch implementation |
166+
| Entry | `scripts/fetch/index.mjs` | Category runner |
167+
| Output | `manifests/github-stars.json` | Stars data |
168+
| Type | `src/types/manifests.ts` | `ManifestGitHubStars` interface |
169+
| Import | `src/lib/generated/github-stars.ts` | Typed import |
170+
| Schema | `manifests/$schemas/github-stars.schema.json` | Validation |
171+
172+
---
173+
174+
## Integration with Build Process
175+
176+
The GitHub stars data is automatically generated as part of the build:
177+
178+
```bash
179+
npm run generate # Includes star fetching
180+
npm run dev # Generate + start dev server
181+
npm run build # Generate + build for production
182+
```
183+
184+
---
185+
186+
## Updating Stars
187+
188+
To update star counts after changes to manifests:
189+
190+
```bash
191+
# Single update
192+
npm run generate
193+
194+
# Force rebuild
195+
rm manifests/github-stars.json && npm run generate
196+
```
197+
198+
---
199+
200+
## Error Handling
201+
202+
The script handles:
203+
204+
1. **Missing GitHub URLs**: Skips products without `communityUrls.github`
205+
2. **Private Repos**: Sets value to `null` for access errors
206+
3. **API Errors**: Logs error and continues
207+
4. **Rate Limits**: Logs warning and returns cached/empty data
208+
209+
---
82210

83211
## Example Output
84212

@@ -88,32 +216,22 @@ The `githubStars` field will be populated with numbers in 'k' format:
88216
βœ… Using GitHub token for authentication
89217

90218
πŸ” Fetching stars for Playwright (microsoft/playwright)...
91-
βœ… Updated Playwright: 65.3k stars
219+
βœ… Updated Playwright: 90450 stars
92220
πŸ” Fetching stars for Context7 (upstash/context7)...
93-
βœ… Updated Context7: 2.1k stars
94-
221+
βœ… Updated Context7: 2150 stars
95222

96223
==================================================
97224
πŸŽ‰ All files processed!
98225
==================================================
99-
```
100-
101-
## Error Handling
102-
103-
The script handles:
104-
- ❌ Invalid GitHub URLs
105-
- ❌ Repositories not found (404)
106-
- ❌ Rate limit errors (403)
107-
- ❌ Network errors
108-
- ⏭️ Projects without GitHub URLs (skipped)
109226

110-
## Rate Limiting
227+
βœ… Written to manifests/github-stars.json
228+
```
111229

112-
The script includes a 1-second delay between requests to avoid hitting rate limits. You can adjust this in the code if needed.
230+
---
113231

114-
## Notes
232+
**Related Files:**
233+
- `src/lib/landscape-data.ts` - Uses stars for sorting
234+
- `src/components/product/ProductHero.tsx` - Displays stars on product pages
235+
- `src/app/[locale]/ides/comparison/page.client.tsx` - Comparison rankings
115236

116-
- Star counts are rounded to 1 decimal place in 'k' format
117-
- Projects without GitHub URLs are skipped
118-
- The script preserves all other fields in the JSON files
119-
- JSON files are formatted with 2-space indentation
237+
**Last Updated:** January 6, 2026

0 commit comments

Comments
Β (0)