loadClaudeConfig method
Load CLAUDE.md configuration
Implementation
Future<Map<String, dynamic>> loadClaudeConfig() async {
if (!hasClaudeConfig()) {
throw Exception('CLAUDE.md not found. Run "claude_toolkit init" first.');
}
final projectDir = getProjectDirectory();
final configFile = File(path.join(projectDir, 'CLAUDE.md'));
final content = await configFile.readAsString();
// Simple parser for CLAUDE.md (would be more sophisticated in real implementation)
final config = <String, dynamic>{
'project_type': 'flutter', // Default
'architecture': 'clean_architecture', // Default
'state_management': 'bloc', // Default
};
// Parse basic configuration from CLAUDE.md
final lines = content.split('\n');
for (final line in lines) {
if (line.contains('**Project Type**:')) {
final match = RegExp(r'`(\w+)`').firstMatch(line);
if (match != null) {
config['project_type'] = match.group(1);
}
}
if (line.contains('**Architecture**:')) {
final match = RegExp(r'`(\w+)`').firstMatch(line);
if (match != null) {
config['architecture'] = match.group(1);
}
}
if (line.contains('**State Management**:')) {
final match = RegExp(r'`(\w+)`').firstMatch(line);
if (match != null) {
config['state_management'] = match.group(1);
}
}
}
return config;
}