Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/design/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ src/DemaConsulting.BuildMark/
├── RepoConnectorFactory.cs — repository connector factory
├── MockRepoConnector.cs — mock repository connector for testing
├── ProcessRunner.cs — process runner for Git commands
├── GitHubRepoConnector.cs — GitHub API integration
└── GitHub/
├── GitHubRepoConnector.cs — GitHub API integration
├── GitHubGraphQLClient.cs — GraphQL API client
└── GitHubGraphQLTypes.cs — GraphQL type definitions
```
Expand Down
2 changes: 1 addition & 1 deletion docs/design/repo-connectors/repo-connectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ GraphQL API to retrieve issues, pull requests, tags, and commits.
| `RepoConnectorFactory` | `RepoConnectors/RepoConnectorFactory.cs` | Creates the appropriate connector |
| `MockRepoConnector` | `RepoConnectors/MockRepoConnector.cs` | In-memory connector for testing |
| `ProcessRunner` | `RepoConnectors/ProcessRunner.cs` | Runs Git commands via the shell |
| `GitHubRepoConnector` | `RepoConnectors/GitHub/GitHubRepoConnector.cs` | GitHub GraphQL API connector |
| `GitHubRepoConnector` | `RepoConnectors/GitHubRepoConnector.cs` | GitHub GraphQL API connector |

## Interfaces

Expand Down
6 changes: 3 additions & 3 deletions docs/design/self-test/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ file, and verifies the file contains expected version and content markers.

### `RunGitIntegration`

Runs the tool against the local Git repository to verify that version, commit
hash, and previous version can be extracted correctly. Validates the output
against expected patterns.
Uses `MockRepoConnector` to verify that the tool correctly extracts and displays
version, commit hash, and previous version information from repository data.
Validates the output against expected patterns.

### `RunIssueTracking`

Expand Down
12 changes: 9 additions & 3 deletions src/DemaConsulting.BuildMark/Cli/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,15 @@ public void WriteError(string message)
if (!Silent)
{
var previousColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Red;
Console.Error.WriteLine(message);
Console.ForegroundColor = previousColor;
try
{
Console.ForegroundColor = ConsoleColor.Red;
Console.Error.WriteLine(message);
}
finally
{
Console.ForegroundColor = previousColor;
}
}

// Write to log file if logging is enabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,9 @@ private static LookupData BuildLookupData(GitHubData data)

// Build a mapping from tag name to release for version lookup.
// This is used to match version objects back to their releases.
var tagToRelease = branchReleases.ToDictionary(r => r.TagName!, r => r);
var tagToRelease = branchReleases
.GroupBy(r => r.TagName!)
.ToDictionary(g => g.Key, g => g.First());

// Parse release tags into Version objects, maintaining release order (newest to oldest).
// This is used to determine version history and find previous releases.
Expand Down
6 changes: 4 additions & 2 deletions src/DemaConsulting.BuildMark/RepoConnectors/ProcessRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,13 @@ public static async Task<string> RunAsync(string command, string arguments)
// Execute process and capture output
using var process = new Process { StartInfo = startInfo };
process.Start();
var output = await process.StandardOutput.ReadToEndAsync();
var outputTask = process.StandardOutput.ReadToEndAsync();
var errorTask = process.StandardError.ReadToEndAsync();
await Task.WhenAll(outputTask, errorTask);
await process.WaitForExitAsync();

// Return output only if command succeeded
return process.ExitCode == 0 ? output : null;
return process.ExitCode == 0 ? outputTask.Result : null;
}
catch
{
Expand Down
10 changes: 5 additions & 5 deletions test/DemaConsulting.BuildMark.Tests/Cli/ContextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -645,12 +645,12 @@ public void Context_WriteError_Silent_DoesNotWriteToConsole()
// Create context with silent flag
using var context = Context.Create(["--silent"]);

// Capture console output
// Capture console error output
using var output = new StringWriter();
var originalOut = Console.Out;
var originalError = Console.Error;
try
{
Console.SetOut(output);
Console.SetError(output);

// Write an error
context.WriteError("Error message");
Expand All @@ -660,8 +660,8 @@ public void Context_WriteError_Silent_DoesNotWriteToConsole()
}
finally
{
// Restore console output
Console.SetOut(originalOut);
// Restore console error output
Console.SetError(originalError);
}
}

Expand Down
Loading