github_analyzer 0.1.8 copy "github_analyzer: ^0.1.8" to clipboard
github_analyzer: ^0.1.8 copied to clipboard

Analyze GitHub repositories and generate AI context for LLMs with cross-platform support

GitHub Analyzer #

Powerful GitHub Repository Analysis Tool for AI/LLM

A pure Dart package that analyzes GitHub repositories and automatically generates markdown documentation optimized for AI and LLM contexts. Accelerate code reviews, documentation, and project onboarding with AI assistance.

pub package License: MIT

โœจ Key Features #

  • ๐Ÿš€ Fast & Efficient - Optimized with isolate-based parallel processing
  • ๐Ÿ“ฆ Dual Mode - Supports both local directories and remote GitHub repositories
  • ๐ŸŽฏ LLM Optimized - Generates compact context for AI models
  • ๐Ÿ”„ Incremental Updates - Smart caching for fast re-analysis
  • ๐ŸŒ Cross-Platform - Works on web, desktop, and mobile
  • ๐Ÿ”’ Private Repositories - Access private repos with GitHub tokens
  • โšก Cache Control - Explicitly enable/disable caching
  • ๐Ÿ”‘ Explicit Token Management - Direct token passing for better security

๐ŸŽฏ Use Cases #

  • AI Code Review - Provide full project context to ChatGPT/Claude
  • Automated Documentation - Auto-analyze project structure and tech stack
  • Onboarding - Quickly share project overview with new team members
  • CI/CD Integration - Detect code changes and generate automatic reports
  • Project Comparison - Compare structure and complexity of multiple repositories

๐Ÿ“ฆ Installation #

Add to your pubspec.yaml:

dependencies:
  github_analyzer: ^0.1.8

Install:

dart pub get

or

dart pub add github_analyzer

๐Ÿš€ Quick Start #

Why you need a token:

  • โœ… Access private repositories
  • โœ… Increased API rate limit (60 โ†’ 5,000 req/hr)
  • โœ… Prevent 403 errors

How to get a token:

  1. Go to GitHub Settings โ†’ Tokens
  2. Generate fine-grained token (recommended)
  3. Set Contents: Read-only permission
  4. Copy the token

2. Basic Usage (Public Repository) #

import 'package:github_analyzer/github_analyzer.dart';

void main() async {
  // Analyze a public repository
  final result = await analyzeQuick(
    'https://github.com/flutter/flutter',
  );

  print('Files: ${result.statistics.totalFiles}');
  print('Lines: ${result.statistics.totalLines}');
  print('Language: ${result.metadata.language}');
}

3. Private Repository Analysis #

import 'package:github_analyzer/github_analyzer.dart';

void main() async {
  // Analyze private repository with token
  final result = await analyzeQuick(
    'https://github.com/your/private-repo',
    githubToken: 'ghp_your_token_here', // Pass token explicitly
  );

  print('Files: ${result.statistics.totalFiles}');
}

4. Generate Markdown for LLM #

import 'package:github_analyzer/github_analyzer.dart';

void main() async {
  // LLM-optimized analysis and markdown generation
  final outputPath = await analyzeForLLM(
    'https://github.com/your/repo',
    githubToken: 'ghp_your_token_here', // For private repos
    outputDir: './analysis',
    maxFiles: 200,
  );

  print('Generated: $outputPath');
}

5. Advanced Usage #

import 'package:github_analyzer/github_analyzer.dart';

void main() async {
  // Create analyzer with custom config
  final config = await GithubAnalyzerConfig.create(
    githubToken: 'ghp_your_token_here', // Pass token explicitly
    excludePatterns: ['test/', 'docs/'],
    maxFileSize: 1024 * 1024, // 1MB
    enableCache: true,
  );

  final analyzer = await GithubAnalyzer.create(config: config);

  // Analyze remote repository (disable cache)
  final result = await analyzer.analyzeRemote(
    repositoryUrl: 'https://github.com/your/repo',
    useCache: false, // Always fetch latest data
  );

  // Generate compact markdown
  final contextService = ContextService();
  final outputPath = await contextService.generate(
    result,
    outputDir: './output',
    config: MarkdownConfig.compact,
  );

  print('Generated: $outputPath');

  // Clean up resources
  await analyzer.dispose();
}

โš™๏ธ Configuration Options #

Quick Analysis (Fast) #

final config = await GithubAnalyzerConfig.quick(
  githubToken: 'your_token', // Optional for public repos
);
  • โšก Fast speed
  • ๐Ÿ“„ Max 100 files
  • ๐Ÿšซ Cache disabled
  • ๐Ÿšซ Isolate disabled

LLM Optimized (Balanced) #

final config = await GithubAnalyzerConfig.forLLM(
  githubToken: 'your_token', // Optional for public repos
  maxFiles: 200,
);
  • โš–๏ธ Balanced performance
  • ๐Ÿ“„ Custom file count
  • โœ… Cache enabled
  • โœ… Isolate enabled
  • ๐Ÿงช Test files excluded

Full Analysis (Comprehensive) #

final config = await GithubAnalyzerConfig.create(
  githubToken: 'your_token', // Optional for public repos
  enableCache: true,
  enableIsolatePool: true,
  maxConcurrentRequests: 10,
);
  • ๐Ÿ” Detailed analysis
  • โ™พ๏ธ Unlimited files
  • โšก Maximum concurrency
  • ๐Ÿ’พ Optimized caching

๐Ÿ”‘ Private Repository Access #

  1. Create token
  2. Repository access: Select "Only select repositories"
  3. Permissions: Contents: Read-only
  4. Copy token

Classic Token #

  1. Create token
  2. Scopes: Check repo
  3. Copy token

Use in Code #

// Option 1: Pass token to convenience functions
final result = await analyzeQuick(
  'https://github.com/user/private-repo',
  githubToken: 'ghp_your_token_here',
);

// Option 2: Pass token via config
final config = await GithubAnalyzerConfig.create(
  githubToken: 'ghp_your_token_here',
);
final analyzer = await GithubAnalyzer.create(config: config);

Secure Token Management #

Best practices:

// 1. Load from environment variables
import 'dart:io';

void main() async {
  final token = Platform.environment['GITHUB_TOKEN'];
  
  final result = await analyzeQuick(
    'https://github.com/user/repo',
    githubToken: token,
  );
}
// 2. Load from secure storage (mobile/desktop)
import 'package:flutter_secure_storage/flutter_secure_storage.dart';

Future<void> analyze() async {
  final storage = FlutterSecureStorage();
  final token = await storage.read(key: 'github_token');
  
  final result = await analyzeQuick(
    'https://github.com/user/repo',
    githubToken: token,
  );
}

๐Ÿ“ค Output Formats #

Compact (LLM Friendly) #

final config = MarkdownConfig.compact;
  • Minimal formatting
  • No statistics
  • Token count optimized

Standard (Balanced) #

final config = MarkdownConfig.standard;
  • Includes statistics
  • Code blocks
  • Directory tree

Detailed (Comprehensive) #

final config = MarkdownConfig.detailed;
  • Full statistics
  • Language distribution
  • Dependency analysis

๐ŸŒ Platform Support #

Platform Local Analysis Remote Analysis Cache Isolates
Desktop โœ… โœ… โœ… โœ…
Mobile โœ… โœ… โœ… โœ…
Web โŒ โœ… โš ๏ธ* โŒ

*Web uses browser storage instead of file system

๐Ÿ› ๏ธ Convenience Functions #

// Quick analysis (public repo)
final result = await analyzeQuick('https://github.com/user/repo');

// Quick analysis (private repo)
final result = await analyzeQuick(
  'https://github.com/user/private-repo',
  githubToken: 'your_token',
);

// LLM-optimized analysis + markdown generation
final outputPath = await analyzeForLLM(
  'https://github.com/user/repo',
  githubToken: 'your_token', // Optional for public repos
  outputDir: './output',
  maxFiles: 100,
);

// Custom config analysis
final result = await analyze(
  'https://github.com/user/repo',
  config: await GithubAnalyzerConfig.create(
    githubToken: 'your_token',
  ),
  verbose: true,
  useCache: false, // Disable cache
);

๐Ÿ” Troubleshooting #

403 Forbidden Error #

Cause: Missing or insufficient GitHub token permissions

Solution:

  1. Ensure you're passing the token correctly:
    final result = await analyzeQuick(
      'https://github.com/user/repo',
      githubToken: 'ghp_your_token_here',
    );
    
  2. Fine-grained token: Verify repository access settings
  3. Classic token: Ensure repo scope is enabled
  4. Test token: curl -H "Authorization: token YOUR_TOKEN" https://api.github.com/user

404 Not Found Error #

Cause: Repository doesn't exist, is private without token, or wrong branch name

Solution:

  1. Verify repository URL is correct
  2. Add GitHub token for private repos
  3. Check default branch name (main vs master)

Rate Limit Exceeded #

Cause: GitHub API rate limit (60 req/hr without token)

Solution:

  • Pass GitHub token to increase limit to 5,000 req/hr:
    final result = await analyzeQuick(
      'https://github.com/user/repo',
      githubToken: 'your_token',
    );
    

Cache Not Respecting useCache: false #

Fixed in v0.1.5: Cache now correctly respects the useCache parameter.

// This will NOT create cache
final result = await analyzer.analyze(
  'https://github.com/user/repo',
  useCache: false,
);

๐Ÿ“ Examples #

Check out more examples in the example/ directory:

  • demo.dart - Comprehensive demo with performance metrics
  • Basic usage examples
  • Custom configuration examples

๐Ÿค Contributing #

Contributions are always welcome! Feel free to submit Pull Requests.

Development Setup #

# Clone repository
git clone https://github.com/cruxhan/github_analyzer.git

# Install dependencies
dart pub get

# Run tests
dart test

๐Ÿ“„ License #

MIT License - See LICENSE file for details.

๐Ÿ’ก Usage Tips #

  1. Large Repositories: Limit file count with maxFiles parameter
  2. Cache Management: Use useCache: false to always fetch latest data
  3. Token Security: Never hardcode tokens - use environment variables or secure storage
  4. Performance Optimization: Enable parallel processing with enableIsolatePool: true
  5. LLM Token Savings: Use MarkdownConfig.compact
  6. Private Repos: Always pass githubToken parameter explicitly

๐Ÿ†• What's New in v0.1.7 #

  • โœ… Fixed: Cache now respects useCache: false parameter
  • โœ… Changed: Removed automatic .env loading for better security
  • โœ… Improved: Explicit token passing via parameters
  • โœ… Fixed: Private repository analysis with HTTP redirect support

Made with โค๏ธ for the Dart & Flutter community

GitHub Analyzer #

AI/LLM์„ ์œ„ํ•œ ๊ฐ•๋ ฅํ•œ GitHub ์ €์žฅ์†Œ ๋ถ„์„ ๋„๊ตฌ

GitHub ์ €์žฅ์†Œ๋ฅผ ๋ถ„์„ํ•˜๊ณ  AI ๋ฐ LLM ์ปจํ…์ŠคํŠธ์— ์ตœ์ ํ™”๋œ ๋งˆํฌ๋‹ค์šด ๋ฌธ์„œ๋ฅผ ์ž๋™ ์ƒ์„ฑํ•˜๋Š” ์ˆœ์ˆ˜ Dart ํŒจํ‚ค์ง€์ž…๋‹ˆ๋‹ค. ์ฝ”๋“œ ๋ฆฌ๋ทฐ, ๋ฌธ์„œํ™”, ํ”„๋กœ์ ํŠธ ์˜จ๋ณด๋”ฉ์„ AI ์ง€์›์œผ๋กœ ๊ฐ€์†ํ™”ํ•˜์„ธ์š”.

pub package License: MIT

โœจ ์ฃผ์š” ๊ธฐ๋Šฅ #

  • ๐Ÿš€ ๋น ๋ฅด๊ณ  ํšจ์œจ์  - Isolate ๊ธฐ๋ฐ˜ ๋ณ‘๋ ฌ ์ฒ˜๋ฆฌ๋กœ ์ตœ์ ํ™”
  • ๐Ÿ“ฆ ์ด์ค‘ ๋ชจ๋“œ - ๋กœ์ปฌ ๋””๋ ‰ํ† ๋ฆฌ ๋ฐ ์›๊ฒฉ GitHub ์ €์žฅ์†Œ ์ง€์›
  • ๐ŸŽฏ LLM ์ตœ์ ํ™” - AI ๋ชจ๋ธ์„ ์œ„ํ•œ ๊ฐ„๊ฒฐํ•œ ์ปจํ…์ŠคํŠธ ์ƒ์„ฑ
  • ๐Ÿ”„ ์ฆ๋ถ„ ์—…๋ฐ์ดํŠธ - ๋น ๋ฅธ ์žฌ๋ถ„์„์„ ์œ„ํ•œ ์Šค๋งˆํŠธ ์บ์‹ฑ
  • ๐ŸŒ ํฌ๋กœ์Šค ํ”Œ๋žซํผ - ์›น, ๋ฐ์Šคํฌํ†ฑ, ๋ชจ๋ฐ”์ผ์—์„œ ์ž‘๋™
  • ๐Ÿ”’ ๋น„๊ณต๊ฐœ ์ €์žฅ์†Œ - GitHub ํ† ํฐ์œผ๋กœ ๋น„๊ณต๊ฐœ ์ €์žฅ์†Œ ์ ‘๊ทผ
  • โšก ์บ์‹œ ์ œ์–ด - ์บ์‹ฑ์„ ๋ช…์‹œ์ ์œผ๋กœ ํ™œ์„ฑํ™”/๋น„ํ™œ์„ฑํ™”
  • ๐Ÿ”‘ ๋ช…์‹œ์  ํ† ํฐ ๊ด€๋ฆฌ - ๋ณด์•ˆ ๊ฐ•ํ™”๋ฅผ ์œ„ํ•œ ์ง์ ‘ ํ† ํฐ ์ „๋‹ฌ

๐ŸŽฏ ์‚ฌ์šฉ ์‚ฌ๋ก€ #

  • AI ์ฝ”๋“œ ๋ฆฌ๋ทฐ - ChatGPT/Claude์— ์ „์ฒด ํ”„๋กœ์ ํŠธ ์ปจํ…์ŠคํŠธ ์ œ๊ณต
  • ์ž๋™ํ™”๋œ ๋ฌธ์„œ - ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ ๋ฐ ๊ธฐ์ˆ  ์Šคํƒ ์ž๋™ ๋ถ„์„
  • ์˜จ๋ณด๋”ฉ - ์‹ ์ž… ํŒ€์›๊ณผ ๋น ๋ฅด๊ฒŒ ํ”„๋กœ์ ํŠธ ๊ฐœ์š” ๊ณต์œ 
  • CI/CD ํ†ตํ•ฉ - ์ฝ”๋“œ ๋ณ€๊ฒฝ ๊ฐ์ง€ ๋ฐ ์ž๋™ ๋ฆฌํฌํŠธ ์ƒ์„ฑ
  • ํ”„๋กœ์ ํŠธ ๋น„๊ต - ๋‹ค์–‘ํ•œ ์ €์žฅ์†Œ์˜ ๊ตฌ์กฐ ๋ฐ ๋ณต์žก์„ฑ ๋น„๊ต

๐Ÿ“ฆ ์„ค์น˜ #

pubspec.yaml์— ์ถ”๊ฐ€:

dependencies:
  github_analyzer: ^0.1.5

์„ค์น˜:

dart pub get

๐Ÿš€ ๋น ๋ฅธ ์‹œ์ž‘ #

1. GitHub ํ† ํฐ ๋ฐœ๊ธ‰ (์„ ํƒ์‚ฌํ•ญ์ด์ง€๋งŒ ๊ถŒ์žฅ) #

ํ† ํฐ์ด ํ•„์š”ํ•œ ์ด์œ :

  • โœ… ๋น„๊ณต๊ฐœ ์ €์žฅ์†Œ ์ ‘๊ทผ
  • โœ… API ์†๋„ ์ œํ•œ ์ฆ๊ฐ€ (60 โ†’ 5,000 req/hr)
  • โœ… 403 ์˜ค๋ฅ˜ ๋ฐฉ์ง€

ํ† ํฐ ๋ฐœ๊ธ‰ ๋ฐฉ๋ฒ•:

  1. GitHub Settings โ†’ Tokens ๋ฐฉ๋ฌธ
  2. Fine-grained ํ† ํฐ ์ƒ์„ฑ (๊ถŒ์žฅ)
  3. Contents: Read-only ๊ถŒํ•œ ์„ค์ •
  4. ํ† ํฐ ๋ณต์‚ฌ

2. ๊ธฐ๋ณธ ์‚ฌ์šฉ๋ฒ• (๊ณต๊ฐœ ์ €์žฅ์†Œ) #

import 'package:github_analyzer/github_analyzer.dart';

void main() async {
  // ๊ณต๊ฐœ ์ €์žฅ์†Œ ๋ถ„์„
  final result = await analyzeQuick(
    'https://github.com/flutter/flutter',
  );

  print('ํŒŒ์ผ: ${result.statistics.totalFiles}');
  print('๋ผ์ธ: ${result.statistics.totalLines}');
  print('์–ธ์–ด: ${result.metadata.language}');
}

3. ๋น„๊ณต๊ฐœ ์ €์žฅ์†Œ ๋ถ„์„ #

import 'package:github_analyzer/github_analyzer.dart';

void main() async {
  // ํ† ํฐ์œผ๋กœ ๋น„๊ณต๊ฐœ ์ €์žฅ์†Œ ๋ถ„์„
  final result = await analyzeQuick(
    'https://github.com/your/private-repo',
    githubToken: 'ghp_your_token_here', // ํ† ํฐ ๋ช…์‹œ์  ์ „๋‹ฌ
  );

  print('ํŒŒ์ผ: ${result.statistics.totalFiles}');
}

4. LLM์šฉ ๋งˆํฌ๋‹ค์šด ์ƒ์„ฑ #

import 'package:github_analyzer/github_analyzer.dart';

void main() async {
  // LLM ์ตœ์ ํ™” ๋ถ„์„ ๋ฐ ๋งˆํฌ๋‹ค์šด ์ƒ์„ฑ
  final outputPath = await analyzeForLLM(
    'https://github.com/your/repo',
    githubToken: 'ghp_your_token_here', // ๋น„๊ณต๊ฐœ ์ €์žฅ์†Œ์˜ ๊ฒฝ์šฐ
    outputDir: './analysis',
    maxFiles: 200,
  );

  print('์ƒ์„ฑ๋จ: $outputPath');
}

5. ๊ณ ๊ธ‰ ์‚ฌ์šฉ๋ฒ• #

import 'package:github_analyzer/github_analyzer.dart';

void main() async {
  // ์‚ฌ์šฉ์ž ์ •์˜ ์„ค์ •์œผ๋กœ ๋ถ„์„๊ธฐ ์ƒ์„ฑ
  final config = await GithubAnalyzerConfig.create(
    githubToken: 'ghp_your_token_here', // ํ† ํฐ ๋ช…์‹œ์  ์ „๋‹ฌ
    excludePatterns: ['test/', 'docs/'],
    maxFileSize: 1024 * 1024, // 1MB
    enableCache: true,
  );

  final analyzer = await GithubAnalyzer.create(config: config);

  // ์›๊ฒฉ ์ €์žฅ์†Œ ๋ถ„์„ (์บ์‹œ ๋น„ํ™œ์„ฑํ™”)
  final result = await analyzer.analyzeRemote(
    repositoryUrl: 'https://github.com/your/repo',
    useCache: false, // ํ•ญ์ƒ ์ตœ์‹  ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ
  );

  // ๊ฐ„๊ฒฐํ•œ ๋งˆํฌ๋‹ค์šด ์ƒ์„ฑ
  final contextService = ContextService();
  final outputPath = await contextService.generate(
    result,
    outputDir: './output',
    config: MarkdownConfig.compact,
  );

  print('์ƒ์„ฑ๋จ: $outputPath');

  // ๋ฆฌ์†Œ์Šค ์ •๋ฆฌ
  await analyzer.dispose();
}

โš™๏ธ ์„ค์ • ์˜ต์…˜ #

๋น ๋ฅธ ๋ถ„์„ (๊ณ ์†) #

final config = await GithubAnalyzerConfig.quick(
  githubToken: 'your_token', // ๊ณต๊ฐœ ์ €์žฅ์†Œ๋Š” ์„ ํƒ์‚ฌํ•ญ
);
  • โšก ๋น ๋ฅธ ์†๋„
  • ๐Ÿ“„ ์ตœ๋Œ€ 100๊ฐœ ํŒŒ์ผ
  • ๐Ÿšซ ์บ์‹œ ๋น„ํ™œ์„ฑํ™”
  • ๐Ÿšซ Isolate ๋น„ํ™œ์„ฑํ™”

LLM ์ตœ์ ํ™” (๊ท ํ˜•) #

final config = await GithubAnalyzerConfig.forLLM(
  githubToken: 'your_token', // ๊ณต๊ฐœ ์ €์žฅ์†Œ๋Š” ์„ ํƒ์‚ฌํ•ญ
  maxFiles: 200,
);
  • โš–๏ธ ๊ท ํ˜•์žกํžŒ ์„ฑ๋Šฅ
  • ๐Ÿ“„ ์‚ฌ์šฉ์ž ์ •์˜ ํŒŒ์ผ ์ˆ˜
  • โœ… ์บ์‹œ ํ™œ์„ฑํ™”
  • โœ… Isolate ํ™œ์„ฑํ™”
  • ๐Ÿงช ํ…Œ์ŠคํŠธ ํŒŒ์ผ ์ œ์™ธ

์ „์ฒด ๋ถ„์„ (์ข…ํ•ฉ) #

final config = await GithubAnalyzerConfig.create(
  githubToken: 'your_token', // ๊ณต๊ฐœ ์ €์žฅ์†Œ๋Š” ์„ ํƒ์‚ฌํ•ญ
  enableCache: true,
  enableIsolatePool: true,
  maxConcurrentRequests: 10,
);
  • ๐Ÿ” ์ƒ์„ธ ๋ถ„์„
  • โ™พ๏ธ ๋ฌด์ œํ•œ ํŒŒ์ผ
  • โšก ์ตœ๋Œ€ ๋™์‹œ์„ฑ
  • ๐Ÿ’พ ์ตœ์ ํ™”๋œ ์บ์‹ฑ

๐Ÿ”‘ ๋น„๊ณต๊ฐœ ์ €์žฅ์†Œ ์ ‘๊ทผ #

Fine-grained ํ† ํฐ (๊ถŒ์žฅ) #

  1. ํ† ํฐ ์ƒ์„ฑ
  2. Repository access: "Only select repositories" ์„ ํƒ
  3. Permissions: Contents: Read-only ์„ค์ •
  4. ํ† ํฐ ๋ณต์‚ฌ

ํด๋ž˜์‹ ํ† ํฐ #

  1. ํ† ํฐ ์ƒ์„ฑ
  2. Scopes: repo ์ฒดํฌ
  3. ํ† ํฐ ๋ณต์‚ฌ

์ฝ”๋“œ์—์„œ ์‚ฌ์šฉ #

// ์˜ต์…˜ 1: ํŽธ์˜ ํ•จ์ˆ˜์— ํ† ํฐ ์ „๋‹ฌ
final result = await analyzeQuick(
  'https://github.com/user/private-repo',
  githubToken: 'ghp_your_token_here',
);

// ์˜ต์…˜ 2: ์„ค์ •์„ ํ†ตํ•ด ํ† ํฐ ์ „๋‹ฌ
final config = await GithubAnalyzerConfig.create(
  githubToken: 'ghp_your_token_here',
);
final analyzer = await GithubAnalyzer.create(config: config);

ํ† ํฐ ์•ˆ์ „ ๊ด€๋ฆฌ #

๋ชจ๋ฒ” ์‚ฌ๋ก€:

// 1. ํ™˜๊ฒฝ ๋ณ€์ˆ˜์—์„œ ๋กœ๋“œ
import 'dart:io';

void main() async {
  final token = Platform.environment['GITHUB_TOKEN'];
  
  final result = await analyzeQuick(
    'https://github.com/user/repo',
    githubToken: token,
  );
}
// 2. ๋ณด์•ˆ ์ €์žฅ์†Œ์—์„œ ๋กœ๋“œ (๋ชจ๋ฐ”์ผ/๋ฐ์Šคํฌํ†ฑ)
import 'package:flutter_secure_storage/flutter_secure_storage.dart';

Future<void> analyze() async {
  final storage = FlutterSecureStorage();
  final token = await storage.read(key: 'github_token');
  
  final result = await analyzeQuick(
    'https://github.com/user/repo',
    githubToken: token,
  );
}

๐Ÿ“ค ์ถœ๋ ฅ ํ˜•์‹ #

๊ฐ„๊ฒฐํ•œ ํ˜•์‹ (LLM ์นœํ™”์ ) #

final config = MarkdownConfig.compact;
  • ์ตœ์†Œ ํฌ๋งทํŒ…
  • ํ†ต๊ณ„ ์—†์Œ
  • ํ† ํฐ ์ˆ˜ ์ตœ์ ํ™”

ํ‘œ์ค€ ํ˜•์‹ (๊ท ํ˜•) #

final config = MarkdownConfig.standard;
  • ํ†ต๊ณ„ ํฌํ•จ
  • ์ฝ”๋“œ ๋ธ”๋ก
  • ๋””๋ ‰ํ† ๋ฆฌ ํŠธ๋ฆฌ

์ƒ์„ธ ํ˜•์‹ (์ข…ํ•ฉ) #

final config = MarkdownConfig.detailed;
  • ์ „์ฒด ํ†ต๊ณ„
  • ์–ธ์–ด ๋ถ„ํฌ
  • ์˜์กด์„ฑ ๋ถ„์„

๐ŸŒ ํ”Œ๋žซํผ ์ง€์› #

ํ”Œ๋žซํผ ๋กœ์ปฌ ๋ถ„์„ ์›๊ฒฉ ๋ถ„์„ ์บ์‹œ Isolates
๋ฐ์Šคํฌํ†ฑ โœ… โœ… โœ… โœ…
๋ชจ๋ฐ”์ผ โœ… โœ… โœ… โœ…
์›น โŒ โœ… โš ๏ธ* โŒ

*์›น์€ ๋ธŒ๋ผ์šฐ์ € ์ €์žฅ์†Œ ์‚ฌ์šฉ

๐Ÿ› ๏ธ ํŽธ์˜ ํ•จ์ˆ˜ #

// ๋น ๋ฅธ ๋ถ„์„ (๊ณต๊ฐœ ์ €์žฅ์†Œ)
final result = await analyzeQuick('https://github.com/user/repo');

// ๋น ๋ฅธ ๋ถ„์„ (๋น„๊ณต๊ฐœ ์ €์žฅ์†Œ)
final result = await analyzeQuick(
  'https://github.com/user/private-repo',
  githubToken: 'your_token',
);

// LLM ์ตœ์ ํ™” ๋ถ„์„ + ๋งˆํฌ๋‹ค์šด ์ƒ์„ฑ
final outputPath = await analyzeForLLM(
  'https://github.com/user/repo',
  githubToken: 'your_token', // ๊ณต๊ฐœ ์ €์žฅ์†Œ๋Š” ์„ ํƒ์‚ฌํ•ญ
  outputDir: './output',
  maxFiles: 100,
);

// ์‚ฌ์šฉ์ž ์ •์˜ ์„ค์ • ๋ถ„์„
final result = await analyze(
  'https://github.com/user/repo',
  config: await GithubAnalyzerConfig.create(
    githubToken: 'your_token',
  ),
  verbose: true,
  useCache: false, // ์บ์‹œ ๋น„ํ™œ์„ฑํ™”
);

๐Ÿ” ๋ฌธ์ œ ํ•ด๊ฒฐ #

403 Forbidden ์˜ค๋ฅ˜ #

์›์ธ: ๋ˆ„๋ฝ๋˜์—ˆ๊ฑฐ๋‚˜ ๋ถˆ์ถฉ๋ถ„ํ•œ GitHub ํ† ํฐ ๊ถŒํ•œ

ํ•ด๊ฒฐ์ฑ…:

  1. ํ† ํฐ์„ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ „๋‹ฌํ•˜๋Š”์ง€ ํ™•์ธ:
    final result = await analyzeQuick(
      'https://github.com/user/repo',
      githubToken: 'ghp_your_token_here',
    );
    
  2. Fine-grained ํ† ํฐ: ์ €์žฅ์†Œ ์ ‘๊ทผ ์„ค์ • ํ™•์ธ
  3. ํด๋ž˜์‹ ํ† ํฐ: repo ๋ฒ”์œ„ ํ™œ์„ฑํ™” ํ™•์ธ
  4. ํ† ํฐ ํ…Œ์ŠคํŠธ: curl -H "Authorization: token YOUR_TOKEN" https://api.github.com/user

404 Not Found ์˜ค๋ฅ˜ #

์›์ธ: ์ €์žฅ์†Œ๊ฐ€ ์—†์Œ, ํ† ํฐ ์—†์ด ๋น„๊ณต๊ฐœ ์ €์žฅ์†Œ ์ ‘๊ทผ, ์ž˜๋ชป๋œ ๋ธŒ๋žœ์น˜๋ช…

ํ•ด๊ฒฐ์ฑ…:

  1. ์ €์žฅ์†Œ URL ์ •ํ™•์„ฑ ํ™•์ธ
  2. ๋น„๊ณต๊ฐœ ์ €์žฅ์†Œ์— GitHub ํ† ํฐ ์ถ”๊ฐ€
  3. ๊ธฐ๋ณธ ๋ธŒ๋žœ์น˜๋ช… ํ™•์ธ (main vs master)

Rate Limit ์ดˆ๊ณผ #

์›์ธ: GitHub API ์†๋„ ์ œํ•œ (ํ† ํฐ ์—†์Œ: 60 req/hr)

ํ•ด๊ฒฐ์ฑ…:

  • GitHub ํ† ํฐ์„ ์ „๋‹ฌํ•˜์—ฌ ํ•œ๋„ ์ฆ๊ฐ€ (5,000 req/hr):
    final result = await analyzeQuick(
      'https://github.com/user/repo',
      githubToken: 'your_token',
    );
    

useCache: false๋ฅผ ๋ฌด์‹œํ•˜๋Š” ์บ์‹œ #

v0.1.5์—์„œ ์ˆ˜์ •๋จ: ์บ์‹œ๊ฐ€ useCache ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ธ์‹ํ•ฉ๋‹ˆ๋‹ค.

// ์ด์ œ ์บ์‹œ๋ฅผ ์ƒ์„ฑํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค
final result = await analyzer.analyze(
  'https://github.com/user/repo',
  useCache: false,
);

๐Ÿ“ ์˜ˆ์ œ #

example/ ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ๋” ๋งŽ์€ ์˜ˆ์ œ๋ฅผ ํ™•์ธํ•˜์„ธ์š”:

  • demo.dart - ์„ฑ๋Šฅ ๋ฉ”ํŠธ๋ฆญ์Šค๋ฅผ ํฌํ•จํ•œ ์ข…ํ•ฉ ๋ฐ๋ชจ
  • ๊ธฐ๋ณธ ์‚ฌ์šฉ ์˜ˆ์ œ
  • ์‚ฌ์šฉ์ž ์ •์˜ ์„ค์ • ์˜ˆ์ œ

๐Ÿค ๊ธฐ์—ฌํ•˜๊ธฐ #

๊ธฐ์—ฌ๋Š” ํ•ญ์ƒ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค! Pull Request๋ฅผ ์ž์œ ๋กญ๊ฒŒ ์ œ์ถœํ•˜์„ธ์š”.

๊ฐœ๋ฐœ ํ™˜๊ฒฝ ์„ค์ • #

# ์ €์žฅ์†Œ ๋ณต์ œ
git clone https://github.com/cruxhan/github_analyzer.git

# ์˜์กด์„ฑ ์„ค์น˜
dart pub get

# ํ…Œ์ŠคํŠธ ์‹คํ–‰
dart test

๐Ÿ“„ ๋ผ์ด์„ ์Šค #

MIT License - ์ž์„ธํ•œ ๋‚ด์šฉ์€ LICENSE ํŒŒ์ผ ์ฐธ์กฐ

๐Ÿ”— ๋งํฌ #

๐Ÿ’ก ์‚ฌ์šฉ ํŒ #

  1. ๋Œ€๊ทœ๋ชจ ์ €์žฅ์†Œ: maxFiles ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ํŒŒ์ผ ์ˆ˜ ์ œํ•œ
  2. ์บ์‹œ ๊ด€๋ฆฌ: ์ตœ์‹  ๋ฐ์ดํ„ฐ๋ฅผ ์œ„ํ•ด useCache: false ์‚ฌ์šฉ
  3. ํ† ํฐ ๋ณด์•ˆ: ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ๋˜๋Š” ๋ณด์•ˆ ์ €์žฅ์†Œ ์‚ฌ์šฉ
  4. ์„ฑ๋Šฅ ์ตœ์ ํ™”: enableIsolatePool: true๋กœ ๋ณ‘๋ ฌ ์ฒ˜๋ฆฌ ํ™œ์„ฑํ™”
  5. LLM ํ† ํฐ ์ ˆ์•ฝ: MarkdownConfig.compact ์‚ฌ์šฉ
  6. ๋น„๊ณต๊ฐœ ์ €์žฅ์†Œ: ํ•ญ์ƒ githubToken ํŒŒ๋ผ๋ฏธํ„ฐ ๋ช…์‹œ์  ์ „๋‹ฌ

๐Ÿ†• v0.1.5์˜ ์ƒˆ ๊ธฐ๋Šฅ #

  • โœ… ์ˆ˜์ •๋จ: useCache: false ํŒŒ๋ผ๋ฏธํ„ฐ ์บ์‹œ ์กด์ค‘
  • โœ… ๋ณ€๊ฒฝ๋จ: ๋ณด์•ˆ ๊ฐ•ํ™”๋ฅผ ์œ„ํ•ด ์ž๋™ .env ๋กœ๋“œ ์ œ๊ฑฐ
  • โœ… ๊ฐœ์„ ๋จ: ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ํ†ตํ•œ ๋ช…์‹œ์  ํ† ํฐ ์ „๋‹ฌ
  • โœ… ์ˆ˜์ •๋จ: HTTP ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ ์ง€์› ์ถ”๊ฐ€

Dart & Flutter ์ปค๋ฎค๋‹ˆํ‹ฐ๋ฅผ ์œ„ํ•ด โค๏ธ ์œผ๋กœ ๋งŒ๋“ค์–ด์กŒ์Šต๋‹ˆ๋‹ค

2
likes
0
points
909
downloads

Publisher

unverified uploader

Weekly Downloads

Analyze GitHub repositories and generate AI context for LLMs with cross-platform support

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

archive, crypto, dio, freezed_annotation, get_it, glob, json_annotation, logging, path, universal_io

More

Packages that depend on github_analyzer