-
Notifications
You must be signed in to change notification settings - Fork 21
add a CI check that the readme file is up-to-date #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,6 +179,13 @@ base mixin DashCliSupport on ToolsSupport, LoggingSupport, RootsTrackingSupport | |
); | ||
} | ||
|
||
static final List<Tool> allTools = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: consider looping through this list in the initialize method so that it is less likely a new tool is added to initialize and not added here. You'd have to store that tools with their associated callback here. |
||
dartFixTool, | ||
dartFormatTool, | ||
runTestsTool, | ||
createProjectTool, | ||
]; | ||
|
||
static final dartFixTool = Tool( | ||
name: 'dart_fix', | ||
description: 'Runs `dart fix --apply` for the given project roots.', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'dart:io'; | ||
|
||
import 'package:dart_mcp/server.dart'; | ||
import 'package:dart_mcp_server/src/mixins/analyzer.dart'; | ||
import 'package:dart_mcp_server/src/mixins/dash_cli.dart'; | ||
import 'package:dart_mcp_server/src/mixins/dtd.dart'; | ||
import 'package:dart_mcp_server/src/mixins/pub.dart'; | ||
import 'package:dart_mcp_server/src/mixins/pub_dev_search.dart'; | ||
|
||
final Map<String, List<Tool>> toolCategories = { | ||
'project': DashCliSupport.allTools, | ||
'analysis': DartAnalyzerSupport.allTools, | ||
'runtime': DartToolingDaemonSupport.allTools, | ||
'pub': PubSupport.allTools, | ||
'pub.dev': PubDevSupport.allTools, | ||
}; | ||
|
||
void main(List<String> args) { | ||
final buf = StringBuffer(); | ||
|
||
for (final entry in toolCategories.entries) { | ||
final category = entry.key; | ||
final tools = entry.value; | ||
|
||
buf.writeln('### $category'); | ||
buf.writeln(''); | ||
Comment on lines
+29
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: use cascades |
||
|
||
for (final tool in tools) { | ||
buf.writeln('- `${tool.name}`: ${tool.description}'); | ||
} | ||
|
||
buf.writeln(''); | ||
} | ||
|
||
final readmeFile = File('README.md'); | ||
final updated = insertBetween( | ||
readmeFile.readAsStringSync(), | ||
buf.toString(), | ||
'<!-- generated -->', | ||
); | ||
readmeFile.writeAsStringSync(updated); | ||
} | ||
|
||
String insertBetween(String original, String insertion, String marker) { | ||
final startIndex = original.indexOf(marker) + marker.length; | ||
final endIndex = original.lastIndexOf(marker); | ||
|
||
return '${original.substring(0, startIndex)}\n\n' | ||
'$insertion${original.substring(endIndex)}'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could just merge this into the job above to avoid the extra setup work 🤷♂️ . This repo isn't large enough to really need multiple jobs.