| 68 | }; |
| 69 | |
| 70 | function parseArgs(): Args { |
| 71 | const argv = process.argv.slice(2); |
| 72 | const out: Args = { |
| 73 | limit: Number.POSITIVE_INFINITY, |
| 74 | minStars: 5, |
| 75 | output: "apps/cursor/.seed/plugins.jsonl", |
| 76 | candidatesCache: "apps/cursor/.seed/candidates.json", |
| 77 | refreshCandidates: false, |
| 78 | resume: false, |
| 79 | }; |
| 80 | for (let i = 0; i < argv.length; i++) { |
| 81 | const a = argv[i]; |
| 82 | if (a === "--limit") out.limit = Number(argv[++i]); |
| 83 | else if (a === "--min-stars") out.minStars = Number(argv[++i]); |
| 84 | else if (a === "--output") out.output = argv[++i]; |
| 85 | else if (a === "--candidates-cache") out.candidatesCache = argv[++i]; |
| 86 | else if (a === "--refresh-candidates") out.refreshCandidates = true; |
| 87 | else if (a === "--resume") out.resume = true; |
| 88 | else if (a === "--help" || a === "-h") { |
| 89 | console.log( |
| 90 | "Usage: extract-from-github.ts [--limit N] [--min-stars N] [--candidates-cache path] [--refresh-candidates] [--output path] [--resume]", |
| 91 | ); |
| 92 | process.exit(0); |
| 93 | } else { |
| 94 | console.error(`Unknown arg: ${a}`); |
| 95 | process.exit(1); |
| 96 | } |
| 97 | } |
| 98 | return out; |
| 99 | } |
| 100 | |
| 101 | function authHeaders(): Record<string, string> { |
| 102 | if (!process.env.GITHUB_TOKEN) { |