da64f769da
- Added optional MCP integration settings in project-brief.yaml, allowing for environment-based server configurations. - Introduced conventions for strict package imports to enhance code organization and maintainability. - Updated brief schema to validate new MCP properties and ensure correct usage. - Implemented MCP JSON builder to generate .cursor/mcp.json based on project brief settings. - Enhanced resolver to include MCP configuration in generated files when enabled. This update improves integration capabilities and enforces coding standards across the project.
48 lines
1.3 KiB
Dart
48 lines
1.3 KiB
Dart
// Regenerates test/golden/* after intentional template changes.
|
|
// Run from generator/: dart run tool/refresh_goldens.dart
|
|
|
|
import 'dart:io';
|
|
|
|
import 'package:path/path.dart' as p;
|
|
|
|
import '../src/models.dart';
|
|
import '../src/renderer.dart';
|
|
import '../src/resolver.dart';
|
|
import '../test/golden_briefs.dart';
|
|
|
|
Future<void> main() async {
|
|
final templateSrc = _templateDir();
|
|
if (!Directory(templateSrc).existsSync()) {
|
|
stderr.writeln('Template dir not found: $templateSrc');
|
|
exitCode = 1;
|
|
return;
|
|
}
|
|
|
|
final cases = <String, ProjectBrief>{
|
|
'bloc-clean-firebase': kBlocCleanFirebaseBrief,
|
|
'riverpod-ff-supabase': kRiverpodFfSupabaseBrief,
|
|
'getx-mvc-rest': kGetxMvcRestBrief,
|
|
};
|
|
|
|
for (final e in cases.entries) {
|
|
final profile = e.key;
|
|
final brief = e.value;
|
|
final rendered = await Renderer.render(
|
|
brief: brief,
|
|
templateFiles: Resolver.resolve(brief),
|
|
templateSrc: templateSrc,
|
|
);
|
|
for (final out in rendered.entries) {
|
|
final file = File('test/golden/$profile/${out.key}');
|
|
await file.parent.create(recursive: true);
|
|
await file.writeAsString(out.value);
|
|
stdout.writeln('Wrote ${file.path}');
|
|
}
|
|
}
|
|
}
|
|
|
|
String _templateDir() {
|
|
final scriptDir = File(Platform.script.toFilePath()).parent;
|
|
return p.normalize(p.join(scriptDir.path, '..', '..', 'templates'));
|
|
}
|