github_analyzer 1.0.0
github_analyzer: ^1.0.0 copied to clipboard
Analyze GitHub repositories and generate AI context for LLMs with cross-platform support
CHANGELOG Tabs (English / νκ΅μ΄) #
πΊπΈ English Version
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[1.0.0] - 2025-11-07 #
Added #
- Improved branch detection - Automatic fallback to default branches when explicit branch fails
- Remote analyzer service refactoring - Better progress tracking and metadata handling
Enhanced #
- Code refactoring - Reduced codebase by ~40% through duplicate removal
- Helper method extraction - Added utility methods for common operations across services
- Error handling consolidation - Unified exception handling patterns
- Validation logic integration - Centralized parameter validation in config service
- Method separation - Improved code organization in LocalAnalyzerService
Fixed #
- Type casting issue - Fixed List
- Isolate pool serialization - Improved error handling for function serialization failures
Optimized #
- Cache service - New helper methods for file operations (_fileExists, _isNotExpired, _readJsonFile)
- IsolatePool - Extracted message validation and result handling to separate methods
- RemoteAnalyzerService - Extracted URL building and exception creation to helpers
- MarkdownService - Streamlined content generation pipeline
Documentation #
- All comments - Converted to English with Dart doc style formatting
- Public APIs - Added comprehensive documentation for all core services
[0.1.9] - 2025-11-06 #
Enhanced #
- Expanded exclude patterns - Added comprehensive file exclusion patterns for platform-specific builds (Android, iOS, Windows, Linux, macOS, Web), CI/CD caches, IDE configurations, and system files to significantly reduce token consumption and improve analysis focus on user-written code.
[0.1.7] - 2025-11-04 #
Added #
- Added detailed DartDoc comments for all public API functions and main entrypoints
- Enhanced dependency injection mechanism to properly propagate GitHub token across services
- Improved error handling and logging during repository download and analysis phases
- Supported better markdown generation options for LLM-optimized outputs
- Added progress tracking callbacks to all analysis entry points for real-time status updates
Fixed #
- Fixed issue where GitHub token was not passed correctly leading to failed private repository downloads
- Resolved rare race condition during cache initialization
- Fixed several null pointer exceptions in remote analysis code paths
- Addressed 404 errors on unexpected branch names with clearer error messages
[0.1.6] - 2025-11-03 #
π₯ Breaking Changes - Removed Automatic .env Loading #
// Before (v0.1.5)
final result = await analyzeForLLM('https://github.com/user/repo');
// After (v0.1.6+)
final result = await analyzeForLLM(
'https://github.com/user/repo',
githubToken: 'ghp_your_token_here',
);
π Critical Fixes - Cache Respecting useCache: false #
// Before (v0.1.5)
if (config.enableCache && cacheService != null) {
await cacheService!.set(repositoryUrl, cacheKey, result);
}
// After (v0.1.6)
if (useCache && config.enableCache && cacheService != null) {
await cacheService!.set(repositoryUrl, cacheKey, result);
}
ποΈ Removed #
- EnvLoader: Removed
src/common/env_loader.dart - Auto .env Loading: Removed from
GithubAnalyzerConfig.create(),.quick(),.forLLM() - Service Locator .env: Removed automatic token loading from DI container
β¨ Added #
- Explicit Token Passing: All functions now support direct
githubTokenparameter - DartDoc Documentation: Added comprehensive English documentation to all public APIs
- Security Guidelines: Added best practices for token management in README
β οΈ Migration Required #
// Option 1: Environment variable
import 'dart:io';
final token = Platform.environment['GITHUB_TOKEN'];
final result = await analyzeForLLM(
'https://github.com/user/private-repo',
githubToken: token,
);
// Option 2: Secure storage
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
final storage = FlutterSecureStorage();
final token = await storage.read(key: 'github_token');
final result = await analyzeQuick(
'https://github.com/user/private-repo',
githubToken: token,
);
// Option 3: Config object
final config = await GithubAnalyzerConfig.create(
githubToken: 'ghp_your_token',
);
final analyzer = await GithubAnalyzer.create(config: config);
π― Benefits #
- β Better Security: No file system access for sensitive data
- β Cross-Platform: Works reliably on all platforms including sandboxed environments
- β Explicit Control: Users have full control over token source
- β Flexibility: Easy integration with various secret management solutions
[0.1.5] - 2025-11-03 #
π₯ Critical Fixes - Private Repository Analysis #
// HTTP Redirect Support
BaseOptions(
connectTimeout: requestTimeout,
receiveTimeout: requestTimeout,
sendTimeout: requestTimeout,
followRedirects: true, // β
NEW
maxRedirects: 5, // β
NEW
)
// Token Change Detection
if (config != null && getIt.isRegistered<GithubAnalyzerConfig>()) {
final existingConfig = getIt<GithubAnalyzerConfig>();
if (existingConfig.githubToken != config.githubToken) {
await getIt.reset();
}
}
π― Results #
| Repository Type | Status | Auto-Token | Files |
|---|---|---|---|
| Public | β | Yes | 249+ |
| Public (with token) | β | Yes | 49+ |
| Private (with token) | β | Yes | 121+ |
β Usage #
await analyzeForLLM(
'https://github.com/private/repo.git',
outputDir: './output',
);
// β
Token auto-loaded, private repo analyzed!
[0.1.4] - 2025-11-03 #
Fixed #
- Fixed EnvLoader project root detection: Now automatically searches for
.envfile in the project root - Added
_findEnvFile()method traversing up to 10 parent directories - Validates project root by checking for
pubspec.yamlor.git
[0.1.3] - 2025-11-03 #
π₯ Critical Fixes - JSON Serialization #
// Before (broken)
factory AnalysisResult.fromJson(Map<String, dynamic> json) =>
_$AnalysisResultFromJson(json);
// After (working)
factory AnalysisResult.fromJson(Map<String, dynamic> json) {
return AnalysisResult(
metadata: RepositoryMetadata.fromJson(json['metadata'] as Map<String, dynamic>),
files: (json['files'] as List<dynamic>)
.map((e) => SourceFile.fromJson(e as Map<String, dynamic>))
.toList(),
statistics: AnalysisStatistics.fromJson(json['statistics'] as Map<String, dynamic>),
);
}
Added #
- New
fetchMetadataOnly()method: Lightweight metadata retrieval (1-3 seconds)
final metadata = await analyzer.fetchMetadataOnly('https://github.com/flutter/flutter');
[0.0.8] - 2025-10-29 #
Added - Explicit Cache Control #
// Disable cache for specific analysis
final result = await analyzeQuick(
'https://github.com/flutter/flutter',
useCache: false,
);
// Or with advanced API
final analyzer = await GithubAnalyzer.create();
final result = await analyzer.analyzeRemote(
repositoryUrl: 'https://github.com/your/repo',
useCache: false,
);
[0.0.7] - 2025-10-19 #
Fixed #
- Fixed Critical Caching Logic: No more stale data after repository push
- Improved Authentication Compatibility: Standardized all GitHub API requests
- Fixed HTTP Retry Bug: Corrected URI path for retrying timed-out requests
[0.0.6] - 2025-10-15 #
Added #
- Automatic
.envfile loading: GitHub tokens automatically loaded from.envfiles - EnvLoader utility: New
EnvLoaderclass for seamless environment variable management - Private repository support: Enhanced ZIP downloader with GitHub API fallback
Changed #
- Breaking:
GithubAnalyzerConfig.quick()andGithubAnalyzerConfig.forLLM()are now async
[0.0.5] - 2025-10-14 #
Added #
- Web platform support with conditional compilation
universal_iopackage integration for cross-platform compatibility
[0.0.4] - 2025-10-13 #
Added #
- Incremental analysis support
- Enhanced caching mechanism
- Performance optimizations
[0.0.3] - 2025-10-12 #
Added #
- LLM-optimized output format
- File prioritization system
- Compact markdown generation
[0.0.2] - 2025-10-11 #
Added #
- Remote repository analysis
- Local directory analysis
- Basic caching system
[0.0.1] - 2025-10-10 #
Added #
- Initial release
- Basic GitHub repository analysis
- Markdown generation
π°π· νκ΅μ΄ λ²μ
λ³κ²½ λ‘κ·Έ #
μ΄ νλ‘μ νΈμ λͺ¨λ μ£Όλͺ©ν λ§ν λ³κ²½μ¬νμ μ΄ νμΌμ λ¬Έμνλ©λλ€.
νμμ Keep a Changelogλ₯Ό κΈ°λ°μΌλ‘ νλ©°, μ΄ νλ‘μ νΈλ μλ―Έμλ λ²μ κ΄λ¦¬λ₯Ό λ°λ¦ λλ€.
[1.0.0] - 2025-11-07 #
μΆκ° κΈ°λ₯ #
- ν₯μλ λΈλ°μΉ κ°μ§ - λͺ μμ λΈλ°μΉ μ€ν¨ μ κΈ°λ³Έ λΈλ°μΉλ‘ μλ ν΄λ°±
- μ격 λΆμ μλΉμ€ 리ν©ν λ§ - ν₯μλ μ§νλ₯ μΆμ λ° λ©νλ°μ΄ν° μ²λ¦¬
κ°μ μ¬ν #
- μ½λ 리ν©ν λ§ - μ€λ³΅ μ κ±°λ₯Ό ν΅ν΄ μ½λλ² μ΄μ€ μ½ 40% μΆμ
- ν¬νΌ λ©μλ μΆμΆ - μλΉμ€ μ λ°μμ κ³΅ν΅ μμ μ μν μ νΈλ¦¬ν° λ©μλ μΆκ°
- μλ¬ μ²λ¦¬ ν΅ν© - μμΈ μ²λ¦¬ ν¨ν΄ ν΅μΌ
- κ²μ¦ λ‘μ§ ν΅ν© - μ€μ μλΉμ€μμ νλΌλ―Έν° κ²μ¦ μ€μν
- λ©μλ λΆλ¦¬ - LocalAnalyzerServiceμ μ½λ μ‘°μ§ κ°μ
λ²κ·Έ μμ #
- νμ μΊμ€ν λ¬Έμ - λλ ν 리 νΈλ¦¬ μμ±μμ List
- Isolate ν μ§λ ¬ν - ν¨μ μ§λ ¬ν μ€ν¨ μ μλ¬ μ²λ¦¬ κ°μ
μ΅μ ν #
- μΊμ μλΉμ€ - νμΌ μμ μ μν μλ‘μ΄ ν¬νΌ λ©μλ μΆκ° (_fileExists, _isNotExpired, _readJsonFile)
- IsolatePool - λ©μμ§ κ²μ¦ λ° κ²°κ³Ό μ²λ¦¬λ₯Ό λ³λ λ©μλλ‘ μΆμΆ
- RemoteAnalyzerService - URL λΉλ λ° μμΈ μμ±μ ν¬νΌλ‘ μΆμΆ
- MarkdownService - μ½ν μΈ μμ± νμ΄νλΌμΈ κ°μν
λ¬Έμν #
- λͺ¨λ μ£Όμ - Dart doc μ€νμΌ νμμΌλ‘ μλ¬ΈμΌλ‘ λ³ν
- κ³΅κ° API - λͺ¨λ ν΅μ¬ μλΉμ€μ λν ν¬κ΄μ μΈ λ¬Έμν μΆκ°
[0.1.9] - 2025-11-06 #
κ°μ #
- exclude ν¨ν΄ λν κ°ν - νλ«νΌλ³ λΉλ νμΌ(Android, iOS, Windows, Linux, macOS, Web), CI/CD μΊμ, IDE μ€μ , μμ€ν νμΌ λ±μ ν¬ν¨ν ν¬κ΄μ μΈ μ μΈ ν¨ν΄ μΆκ°.
[0.1.7] - 2025-11-04 #
μΆκ°λ¨ #
- λͺ¨λ κ³΅κ° API ν¨μμ μμΈν DartDoc μ£Όμ μΆκ°
- GitHub ν ν°μ μλΉμ€ μ λ°μ κ±Έμ³ μ¬λ°λ₯΄κ² μ ννλλ‘ μμ‘΄μ± μ£Όμ λ©μ»€λμ¦ κ°ν
- μ μ₯μ λ€μ΄λ‘λ λ° λΆμ λ¨κ³ μ€ μ€λ₯ μ²λ¦¬ λ° λ‘κΉ κ°μ
- LLM μ΅μ ν μΆλ ₯μ μν λ λμ λ§ν¬λ€μ΄ μμ± μ΅μ μ§μ
- λͺ¨λ λΆμ μνΈλ¦¬ν¬μΈνΈμ μ€μκ° μν μ λ°μ΄νΈλ₯Ό μν μ§νλ₯ μΆμ μ½λ°± μΆκ°
μμ λ¨ #
- GitHub ν ν°μ΄ μ¬λ°λ₯΄κ² μ λ¬λμ§ μμ λΉκ³΅κ° μ μ₯μ λ€μ΄λ‘λ μ€ν¨νλ λ¬Έμ μμ
- μΊμ μ΄κΈ°ν μ€ μ€λλ λ°μ΄ν° μ¬μ©μΌλ‘ μΈν λλ¬Έ λ μ΄μ€ 컨λμ ν΄κ²°
- μ격 λΆμ μ½λ κ²½λ‘μμ μ¬λ¬ null ν¬μΈν° μμΈ μμ
- μμμΉ λͺ»ν λΈλμΉλͺ μ λν 404 μ€λ₯λ₯Ό λ λͺ νν μ€λ₯ λ©μμ§λ‘ ν΄κ²°
[0.1.6] - 2025-11-03 #
π₯ μ£Όμ λ³κ²½μ¬ν - μλ .env λ‘λ μ κ±° #
// μ΄μ (v0.1.5)
final result = await analyzeForLLM('https://github.com/user/repo');
// μ΄ν (v0.1.6+)
final result = await analyzeForLLM(
'https://github.com/user/repo',
githubToken: 'ghp_your_token_here',
);
π μΉλͺ μ λ²κ·Έ μμ - useCache: false νλΌλ―Έν° μ‘΄μ€ #
// μ΄μ (v0.1.5)
if (config.enableCache && cacheService != null) {
await cacheService!.set(repositoryUrl, cacheKey, result);
}
// μ΄ν (v0.1.6)
if (useCache && config.enableCache && cacheService != null) {
await cacheService!.set(repositoryUrl, cacheKey, result);
}
ποΈ μ κ±°λ¨ #
- EnvLoader:
src/common/env_loader.dartμ κ±° - μλ .env λ‘λ:
GithubAnalyzerConfig.create(),.quick(),.forLLM()μμ μ κ±° - Service Locator .env: DI 컨ν μ΄λμ μλ ν ν° λ‘λ μ κ±°
β¨ μΆκ°λ¨ #
- λͺ
μμ ν ν° μ λ¬: λͺ¨λ ν¨μκ° μ΄μ μ§μ
githubTokenνλΌλ―Έν° μ§μ - DartDoc λ¬Έμν: λͺ¨λ κ³΅κ° APIμ ν¬κ΄μ μΈ μμ΄ λ¬Έμ μΆκ°
- 보μ κ°μ΄λλΌμΈ: READMEμ ν ν° κ΄λ¦¬ λͺ¨λ² μ¬λ‘ μΆκ°
β οΈ λ§μ΄κ·Έλ μ΄μ νμ #
// μ΅μ
1: νκ²½ λ³μ
import 'dart:io';
final token = Platform.environment['GITHUB_TOKEN'];
final result = await analyzeForLLM(
'https://github.com/user/private-repo',
githubToken: token,
);
// μ΅μ
2: 보μ μ μ₯μ
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
final storage = FlutterSecureStorage();
final token = await storage.read(key: 'github_token');
final result = await analyzeQuick(
'https://github.com/user/private-repo',
githubToken: token,
);
// μ΅μ
3: μ€μ κ°μ²΄
final config = await GithubAnalyzerConfig.create(
githubToken: 'ghp_your_token',
);
final analyzer = await GithubAnalyzer.create(config: config);
π― μ₯μ #
- β λ λμ 보μ: λ―Όκ°ν λ°μ΄ν°μ λν νμΌ μμ€ν μ κ·Ό μμ
- β ν¬λ‘μ€ νλ«νΌ: μλλ°μ€ νκ²½μ ν¬ν¨ν λͺ¨λ νλ«νΌμμ μμ μ μΌλ‘ μλ
- β λͺ μμ μ μ΄: μ¬μ©μκ° ν ν° μμ€μ λν μμ ν μ μ΄ κ°λ₯
- β μ μ°μ±: λ€μν λΉλ° κ΄λ¦¬ μ루μ κ³Ό μ¬μ΄ ν΅ν©
[0.1.5] - 2025-11-03 #
π₯ μΉλͺ μ λ²κ·Έ μμ - λΉκ³΅κ° μ μ₯μ λΆμ #
// HTTP 리λ€μ΄λ νΈ μ§μ
BaseOptions(
connectTimeout: requestTimeout,
receiveTimeout: requestTimeout,
sendTimeout: requestTimeout,
followRedirects: true, // β
μ κ·
maxRedirects: 5, // β
μ κ·
)
// ν ν° λ³κ²½ κ°μ§
if (config != null && getIt.isRegistered<GithubAnalyzerConfig>()) {
final existingConfig = getIt<GithubAnalyzerConfig>();
if (existingConfig.githubToken != config.githubToken) {
await getIt.reset();
}
}
π― κ²°κ³Ό #
| μ μ₯μ μ ν | μν | μλ ν ν° | νμΌ |
|---|---|---|---|
| κ³΅κ° | β | μ | 249+ |
| κ³΅κ° (ν ν° ν¬ν¨) | β | μ | 49+ |
| λΉκ³΅κ° (ν ν° ν¬ν¨) | β | μ | 121+ |
β μ¬μ©λ² #
await analyzeForLLM(
'https://github.com/private/repo.git',
outputDir: './output',
);
// β
.envμμ ν ν° μλ λ‘λ, λΉκ³΅κ° μ μ₯μ μ±κ³΅!
[0.1.4] - 2025-11-03 #
μμ λ¨ #
- EnvLoader νλ‘μ νΈ λ£¨νΈ κ°μ§ μμ : μ΄μ νλ‘μ νΈ λ£¨νΈμμ
.envνμΌ μλ κ²μ - μ΅λ 10κ° λΆλͺ¨ λλ ν 리κΉμ§ νΈλλ²μ€νλ
_findEnvFile()λ©μλ μΆκ° pubspec.yamlλλ.gitνμΈμΌλ‘ νλ‘μ νΈ λ£¨νΈ κ²μ¦
[0.1.3] - 2025-11-03 #
π₯ μΉλͺ μ λ²κ·Έ μμ - JSON μ§λ ¬ν #
// μ΄μ (μμλ¨)
factory AnalysisResult.fromJson(Map<String, dynamic> json) =>
_$AnalysisResultFromJson(json);
// μ΄ν (μλν¨)
factory AnalysisResult.fromJson(Map<String, dynamic> json) {
return AnalysisResult(
metadata: RepositoryMetadata.fromJson(json['metadata'] as Map<String, dynamic>),
files: (json['files'] as List<dynamic>)
.map((e) => SourceFile.fromJson(e as Map<String, dynamic>))
.toList(),
statistics: AnalysisStatistics.fromJson(json['statistics'] as Map<String, dynamic>),
);
}
μΆκ°λ¨ #
- μλ‘μ΄
fetchMetadataOnly()λ©μλ: κ°λ²Όμ΄ λ©νλ°μ΄ν° μ‘°ν (1-3μ΄)
final metadata = await analyzer.fetchMetadataOnly('https://github.com/flutter/flutter');
[0.0.8] - 2025-10-29 #
μΆκ°λ¨ - λͺ μμ μΊμ μ μ΄ #
// νΉμ λΆμμ λν΄ μΊμ λΉνμ±ν
final result = await analyzeQuick(
'https://github.com/flutter/flutter',
useCache: false,
);
// λλ κ³ κΈ API μ¬μ©
final analyzer = await GithubAnalyzer.create();
final result = await analyzer.analyzeRemote(
repositoryUrl: 'https://github.com/your/repo',
useCache: false,
);
[0.0.7] - 2025-10-19 #
μμ λ¨ #
- μΉλͺ μ μΊμ± λ‘μ§ μμ : μ μ₯μ νΈμ ν μ€λλ λ°μ΄ν° λ°ν μμ
- μΈμ¦ νΈνμ± κ°μ : λͺ¨λ GitHub API μμ² νμ€ν
- HTTP μ¬μλ λ²κ·Έ μμ : μκ° μ΄κ³Ό μμ² μ¬μλ URI κ²½λ‘ μμ
[0.0.6] - 2025-10-15 #
μΆκ°λ¨ #
- μλ
.envνμΌ λ‘λ: GitHub ν ν°μ΄.envνμΌμμ μλμΌλ‘ λ‘λλ¨ - EnvLoader μ νΈλ¦¬ν°: μνν νκ²½ λ³μ κ΄λ¦¬λ₯Ό μν μλ‘μ΄
EnvLoaderν΄λμ€ - λΉκ³΅κ° μ μ₯μ μ§μ: λΉκ³΅κ° μ μ₯μλ₯Ό μν GitHub API ν΄λ°±μ΄ μλ ν₯μλ ZIP λ€μ΄λ‘λ
λ³κ²½λ¨ #
- μ£Όμ λ³κ²½:
GithubAnalyzerConfig.quick()λ°GithubAnalyzerConfig.forLLM()μ μ΄μ λΉλκΈ°
[0.0.5] - 2025-10-14 #
μΆκ°λ¨ #
- μ‘°κ±΄λΆ μ»΄νμΌμ ν¬ν¨ν μΉ νλ«νΌ μ§μ
universal_ioν¨ν€μ§ ν΅ν©μΌλ‘ ν¬λ‘μ€ νλ«νΌ νΈνμ±
[0.0.4] - 2025-10-13 #
μΆκ°λ¨ #
- μ¦λΆ λΆμ μ§μ
- κ°νλ μΊμ± λ©μ»€λμ¦
- μ±λ₯ μ΅μ ν
[0.0.3] - 2025-10-12 #
μΆκ°λ¨ #
- LLM μ΅μ ν μΆλ ₯ νμ
- νμΌ μ°μ μμ μ§μ μμ€ν
- κ°κ²°ν λ§ν¬λ€μ΄ μμ±
[0.0.2] - 2025-10-11 #
μΆκ°λ¨ #
- μ격 μ μ₯μ λΆμ
- λ‘컬 λλ ν 리 λΆμ
- κΈ°λ³Έ μΊμ± μμ€ν
[0.0.1] - 2025-10-10 #
μΆκ°λ¨ #
- μ΄κΈ° 릴리μ€
- κΈ°λ³Έ GitHub μ μ₯μ λΆμ
- λ§ν¬λ€μ΄ μμ±