refactor: clarify tracker client naming (#6)
Rename the provider-aware tracker client and scope since cutoffs per provider so review-driven cleanup improves readability and avoids extra tracker fetches.
This commit is contained in:
parent
cf1d8ec782
commit
a474ed243d
|
|
@ -1,7 +1,7 @@
|
||||||
export 'src/comment_templates.dart';
|
export 'src/comment_templates.dart';
|
||||||
export 'src/config.dart';
|
export 'src/config.dart';
|
||||||
export 'src/database.dart';
|
export 'src/database.dart';
|
||||||
export 'src/github_client.dart';
|
export 'src/issue_tracker_client.dart';
|
||||||
export 'src/issue_assistant_app.dart';
|
export 'src/issue_assistant_app.dart';
|
||||||
export 'src/notifier.dart';
|
export 'src/notifier.dart';
|
||||||
export 'src/workspace_manager.dart';
|
export 'src/workspace_manager.dart';
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'config.dart';
|
import 'config.dart';
|
||||||
import 'github_client.dart';
|
import 'issue_tracker_client.dart';
|
||||||
|
|
||||||
class CliResponderRunner {
|
class CliResponderRunner {
|
||||||
Future<ResponderResult> run({
|
Future<ResponderResult> run({
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import 'package:logging/logging.dart';
|
||||||
import 'cli_responder.dart';
|
import 'cli_responder.dart';
|
||||||
import 'config.dart';
|
import 'config.dart';
|
||||||
import 'database.dart';
|
import 'database.dart';
|
||||||
import 'github_client.dart';
|
import 'issue_tracker_client.dart';
|
||||||
import 'notifier.dart';
|
import 'notifier.dart';
|
||||||
import 'workspace_manager.dart';
|
import 'workspace_manager.dart';
|
||||||
|
|
||||||
|
|
@ -28,7 +28,7 @@ class IssueAssistantApp {
|
||||||
|
|
||||||
final AppConfig config;
|
final AppConfig config;
|
||||||
final AppDatabase database;
|
final AppDatabase database;
|
||||||
final GitHubClient issueTrackerClient;
|
final IssueTrackerClient issueTrackerClient;
|
||||||
final CliResponderRunner responderRunner;
|
final CliResponderRunner responderRunner;
|
||||||
final WorkspaceManager workspaceManager;
|
final WorkspaceManager workspaceManager;
|
||||||
final NotifierRegistry Function(ProjectConfig project)
|
final NotifierRegistry Function(ProjectConfig project)
|
||||||
|
|
@ -50,7 +50,7 @@ class IssueAssistantApp {
|
||||||
return IssueAssistantApp._(
|
return IssueAssistantApp._(
|
||||||
config: config,
|
config: config,
|
||||||
database: database,
|
database: database,
|
||||||
issueTrackerClient: GitHubClient(
|
issueTrackerClient: IssueTrackerClient(
|
||||||
ghCommand: ghCommand,
|
ghCommand: ghCommand,
|
||||||
teaCommand: teaCommand,
|
teaCommand: teaCommand,
|
||||||
),
|
),
|
||||||
|
|
@ -259,14 +259,6 @@ class IssueAssistantApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final batchSince = sinceByProject.values
|
|
||||||
.whereType<DateTime>()
|
|
||||||
.fold<DateTime?>(null, (current, next) {
|
|
||||||
if (current == null || next.isBefore(current)) {
|
|
||||||
return next;
|
|
||||||
}
|
|
||||||
return current;
|
|
||||||
});
|
|
||||||
final issuesByProject = <String, List<GitHubIssueSummary>>{
|
final issuesByProject = <String, List<GitHubIssueSummary>>{
|
||||||
for (final project in projects) project.key: <GitHubIssueSummary>[],
|
for (final project in projects) project.key: <GitHubIssueSummary>[],
|
||||||
};
|
};
|
||||||
|
|
@ -277,11 +269,20 @@ class IssueAssistantApp {
|
||||||
if (providerProjects.isEmpty) {
|
if (providerProjects.isEmpty) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
final providerSince = providerProjects
|
||||||
|
.map((project) => sinceByProject[project.key])
|
||||||
|
.whereType<DateTime>()
|
||||||
|
.fold<DateTime?>(null, (current, next) {
|
||||||
|
if (current == null || next.isBefore(current)) {
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
return current;
|
||||||
|
});
|
||||||
|
|
||||||
final issues = await issueTrackerClient.fetchUpdatedIssuesForRepos(
|
final issues = await issueTrackerClient.fetchUpdatedIssuesForRepos(
|
||||||
provider: provider,
|
provider: provider,
|
||||||
repos: providerProjects.map((project) => project.repoSlug),
|
repos: providerProjects.map((project) => project.repoSlug),
|
||||||
since: batchSince,
|
since: providerSince,
|
||||||
);
|
);
|
||||||
for (final issue in issues) {
|
for (final issue in issues) {
|
||||||
final project =
|
final project =
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ import 'package:github/github.dart';
|
||||||
|
|
||||||
import 'config_schema.dart';
|
import 'config_schema.dart';
|
||||||
|
|
||||||
class GitHubClient {
|
class IssueTrackerClient {
|
||||||
GitHubClient({this.ghCommand = 'gh', this.teaCommand = 'tea'});
|
IssueTrackerClient({this.ghCommand = 'gh', this.teaCommand = 'tea'});
|
||||||
|
|
||||||
final String ghCommand;
|
final String ghCommand;
|
||||||
final String teaCommand;
|
final String teaCommand;
|
||||||
Loading…
Reference in New Issue