Skip to content

Commit 3f4c560

Browse files
chore(serinus_cli): prepare for release 2.1.2
1 parent 921c6e1 commit 3f4c560

5 files changed

Lines changed: 74 additions & 38 deletions

File tree

packages/serinus_cli/lib/src/commands/agents_command.dart

Lines changed: 67 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import 'package:path/path.dart' as path;
77
import 'package:serinus_cli/src/utils/config.dart'; // Reuse your Config logic
88

99
class AgentsCommand extends Command<int> {
10-
1110
AgentsCommand({required Logger logger}) : _logger = logger {
1211
argParser.addFlag(
1312
'claude',
@@ -19,7 +18,8 @@ class AgentsCommand extends Command<int> {
1918
final String name = 'agents';
2019

2120
@override
22-
final String description = 'Generates AGENTS.md and CLAUDE.md and downloads local docs for AI context.';
21+
final String description =
22+
'Generates AGENTS.md and CLAUDE.md and downloads local docs for AI context.';
2323

2424
final Logger _logger;
2525

@@ -31,17 +31,45 @@ class AgentsCommand extends Command<int> {
3131
// We can reuse getProjectConfiguration logic or read pubspec directly
3232
final config = await getProjectConfiguration(_logger, deps: true);
3333
final serinusVersion = config.dependencies['serinus'];
34-
34+
3535
// Fallback if version is a path or git dependency, otherwise strict version
36-
var versionTag = _parseVersion(serinusVersion);
36+
var versionTag = _parseVersion(serinusVersion);
3737
_logger.detail('Detected Serinus version: $versionTag');
3838

3939
// 2. Define Docs to Download
4040
// You can fetch the file list dynamically from GitHub API or hardcode the structure based on your config.mts sidebar
4141
final docsMap = {
42-
'overview': ['modules.md', 'controllers.md', 'routes.md', 'hooks.md', 'middlewares.md', 'providers.md', 'pipes.md', 'metadata.md', 'exception_filters.md'],
43-
'techniques': ['database.md', 'configuration.md', 'logging.md', 'sse.md', 'task_scheduling.md', 'file_uploads.md', 'mvc.md', 'serve_static.md', 'versioning.md', 'global_prefix.md', 'session.md', 'model_provider.md'],
44-
'security': ['rate_limiting.md', 'cors.md', 'body_size.md', 'authentication.md'],
42+
'overview': [
43+
'modules.md',
44+
'controllers.md',
45+
'routes.md',
46+
'hooks.md',
47+
'middlewares.md',
48+
'providers.md',
49+
'pipes.md',
50+
'metadata.md',
51+
'exception_filters.md'
52+
],
53+
'techniques': [
54+
'database.md',
55+
'configuration.md',
56+
'logging.md',
57+
'sse.md',
58+
'task_scheduling.md',
59+
'file_uploads.md',
60+
'mvc.md',
61+
'serve_static.md',
62+
'versioning.md',
63+
'global_prefix.md',
64+
'session.md',
65+
'model_provider.md'
66+
],
67+
'security': [
68+
'rate_limiting.md',
69+
'cors.md',
70+
'body_size.md',
71+
'authentication.md'
72+
],
4573
'openapi': ['index.md', 'advanced_usage.md', 'renderer.md'],
4674
'websockets': ['gateways.md', 'exception_filters.md', 'pipes.md'],
4775
'comparisons': ['dart_frog.md', 'shelf.md'],
@@ -50,13 +78,15 @@ class AgentsCommand extends Command<int> {
5078
'deployment': ['docker.md', 'globe.md', 'vps.md', 'cloud_run.md'],
5179
};
5280

53-
final docsDir = Directory(path.join(Directory.current.path, '.serinus-docs'));
81+
final docsDir =
82+
Directory(path.join(Directory.current.path, '.serinus-docs'));
5483
if (!docsDir.existsSync()) {
5584
docsDir.createSync();
5685
}
5786

5887
// 3. Download Files
59-
var baseUrl = 'https://raw.githubusercontent.com/francescovallone/serinus/$versionTag/.website';
88+
var baseUrl =
89+
'https://raw.githubusercontent.com/francescovallone/serinus/$versionTag/.website';
6090
if (versionTag == 'any' || versionTag == 'main' || versionTag == 'latest') {
6191
versionTag = 'main';
6292
}
@@ -66,30 +96,31 @@ class AgentsCommand extends Command<int> {
6696
final checkResponse = await http.get(checkUrl);
6797
print('Checking URL: $checkUrl - Status: ${checkResponse.statusCode}');
6898
if (checkResponse.statusCode != 200) {
69-
_logger.warn('Version $versionTag not found on GitHub, falling back to main branch for docs.');
99+
_logger.warn(
100+
'Version $versionTag not found on GitHub, falling back to main branch for docs.');
70101
versionTag = 'main';
71102
}
72103
}
73-
baseUrl = 'https://raw.githubusercontent.com/francescovallone/serinus/$versionTag/.website';
104+
baseUrl =
105+
'https://raw.githubusercontent.com/francescovallone/serinus/$versionTag/.website';
74106
final progress = _logger.progress('Downloading documentation...');
75107
try {
76108
for (final category in docsMap.keys) {
77109
final categoryDir = Directory(path.join(docsDir.path, category));
78110
if (!categoryDir.existsSync()) categoryDir.createSync();
79111

80112
for (final file in docsMap[category]!) {
81-
// Handle the path structure in your repo (some are in root, some in subfolders)
82-
// Based on your file list, many are directly in .website or .website/techniques
83-
final remotePath = category == 'overview'
84-
? file
85-
: '$category/$file';
86-
87-
final url = Uri.parse('$baseUrl/$remotePath');
88-
final response = await http.get(url);
89-
90-
if (response.statusCode == 200) {
91-
File(path.join(categoryDir.path, file)).writeAsStringSync(response.body);
92-
}
113+
// Handle the path structure in your repo (some are in root, some in subfolders)
114+
// Based on your file list, many are directly in .website or .website/techniques
115+
final remotePath = category == 'overview' ? file : '$category/$file';
116+
117+
final url = Uri.parse('$baseUrl/$remotePath');
118+
final response = await http.get(url);
119+
120+
if (response.statusCode == 200) {
121+
File(path.join(categoryDir.path, file))
122+
.writeAsStringSync(response.body);
123+
}
93124
}
94125
}
95126
progress.complete('Documentation downloaded to .serinus-docs/');
@@ -107,21 +138,23 @@ class AgentsCommand extends Command<int> {
107138
String _parseVersion(dynamic version) {
108139
// Logic to strip caret ^ or handle 'any'. Default to 'main' if unknown.
109140
if (version is String) {
110-
return version.replaceAll('^', '').replaceAll('~', '');
141+
return version.replaceAll('^', '').replaceAll('~', '');
111142
}
112-
return 'main';
143+
return 'main';
113144
}
114145

115146
void _generateAgentsMd(Map<String, List<String>> docsMap) {
116147
final buffer = StringBuffer()
117-
..write('<!--- SERINUS-AGENTS-MD-START -->')
118-
// Create the compressed index format Vercel recommends
119-
..write('[Serinus Docs Index]|root: ./.serinus-docs')
120-
..write('|IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any Serinus related queries.')
121-
..write('|If docs missing run `serinus agents` to download the latest version.');
148+
..write('<!--- SERINUS-AGENTS-MD-START -->')
149+
// Create the compressed index format Vercel recommends
150+
..write('[Serinus Docs Index]|root: ./.serinus-docs')
151+
..write(
152+
'|IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any Serinus related queries.')
153+
..write(
154+
'|If docs missing run `serinus agents` to download the latest version.');
122155
docsMap.forEach((category, files) {
123-
// Format: |category:{file1.md,file2.md}
124-
buffer.write('|$category:{${files.join(',')}}');
156+
// Format: |category:{file1.md,file2.md}
157+
buffer.write('|$category:{${files.join(',')}}');
125158
});
126159
buffer.writeln('<!--- SERINUS-AGENTS-MD-END -->');
127160
File(path.join(Directory.current.path, 'AGENTS.md')).writeAsStringSync(
@@ -133,9 +166,9 @@ class AgentsCommand extends Command<int> {
133166
buffer.toString(),
134167
);
135168
}
136-
169+
137170
_logger.success('Generated AGENTS.md');
138171
}
139172

140173
bool get claude => argResults?['claude'] as bool? ?? false;
141-
}
174+
}

packages/serinus_cli/lib/src/commands/commands.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ export 'agents_command.dart';
22
export 'deploy_command.dart';
33
export 'generate/generate_command.dart';
44
export 'generate/generate_models/generate_models_command.dart';
5-
export 'update_command.dart';
5+
export 'update_command.dart';

packages/serinus_cli/lib/src/commands/generate/generate_models/generate_models_command.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,8 @@ class GenerateModelsCommand extends Command<int> {
359359
if (rawDependencyPath is! String) {
360360
continue;
361361
}
362-
final dependencyPath = _resolveInputPath(projectRoot, rawDependencyPath);
362+
final dependencyPath =
363+
_resolveInputPath(projectRoot, rawDependencyPath);
363364

364365
int score;
365366
if (dependencyPath == absoluteExtraPath) {

packages/serinus_cli/lib/src/commands/run/run_command.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ class RunCommand extends Command<int> {
8585
});
8686
// Also handle SIGTERM where available
8787
if (!Platform.isWindows) {
88-
_sigtermSubscription = ProcessSignal.sigterm.watch().listen((event) async {
88+
_sigtermSubscription =
89+
ProcessSignal.sigterm.watch().listen((event) async {
8990
try {
9091
await _killProcess(process);
9192
await signalSubscription?.cancel();

packages/serinus_cli/lib/src/utils/config.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ class ModelsConfig {
103103
((yaml['serialize_keywords'] as YamlList?)?.value ?? [])
104104
.map((e) => SerializeKeyword.fromYaml((e as YamlMap).value))
105105
.toList(),
106-
extraPaths: List<String>.from((yaml['extra_paths'] as YamlList?)?.value ?? []),
106+
extraPaths:
107+
List<String>.from((yaml['extra_paths'] as YamlList?)?.value ?? []),
107108
);
108109
}
109110
}

0 commit comments

Comments
 (0)