Skip to content

Commit f615219

Browse files
author
feiyun0112
committed
dotnet format
1 parent ef54ef8 commit f615219

13 files changed

+59
-58
lines changed

src/SpecCodingMcpServer/Exceptions/SessionNotFoundException.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class SessionNotFoundException : Exception
2222
/// Initializes a new instance of the SessionNotFoundException class with the specified session ID.
2323
/// </summary>
2424
/// <param name="sessionId">The ID of the session that was not found.</param>
25-
public SessionNotFoundException(string sessionId)
25+
public SessionNotFoundException(string sessionId)
2626
: base($"Session not found: {sessionId}")
2727
{
2828
SessionId = sessionId;
@@ -34,7 +34,7 @@ public SessionNotFoundException(string sessionId)
3434
/// </summary>
3535
/// <param name="sessionId">The ID of the session that was not found.</param>
3636
/// <param name="message">The custom error message that describes the exception.</param>
37-
public SessionNotFoundException(string sessionId, string message)
37+
public SessionNotFoundException(string sessionId, string message)
3838
: base(message)
3939
{
4040
SessionId = sessionId;
@@ -47,7 +47,7 @@ public SessionNotFoundException(string sessionId, string message)
4747
/// <param name="sessionId">The ID of the session that was not found.</param>
4848
/// <param name="message">The custom error message that describes the exception.</param>
4949
/// <param name="innerException">The exception that is the cause of the current exception.</param>
50-
public SessionNotFoundException(string sessionId, string message, Exception innerException)
50+
public SessionNotFoundException(string sessionId, string message, Exception innerException)
5151
: base(message, innerException)
5252
{
5353
SessionId = sessionId;

src/SpecCodingMcpServer/Models/SpecCodingConfiguration.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class SpecCodingConfiguration
2626
/// </summary>
2727
[Required]
2828
public string OutputPath { get; set; } = ".spec-coding";
29-
29+
3030
/// <summary>
3131
/// Gets or sets the timeout duration for inactive sessions.
3232
/// Sessions that exceed this timeout without activity will be automatically cleaned up.
@@ -41,8 +41,8 @@ public class SpecCodingConfiguration
4141
/// <returns>The absolute path to the prompts directory.</returns>
4242
public string GetAbsolutePromptsPath()
4343
{
44-
return Path.IsPathRooted(PromptsPath)
45-
? PromptsPath
44+
return Path.IsPathRooted(PromptsPath)
45+
? PromptsPath
4646
: Path.Combine(AppDomain.CurrentDomain.BaseDirectory, PromptsPath);
4747
}
4848
}

src/SpecCodingMcpServer/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@
6262
// This ensures the server exits gracefully with proper error logging
6363
catch (Exception ex)
6464
{
65-
Log.Fatal(ex,"Error");
65+
Log.Fatal(ex, "Error");
6666
}

src/SpecCodingMcpServer/Services/ContextManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ internal class ContextManager : IContextManager
5252
public ContextManager(IFileService fileService, ILogger<ContextManager> logger)
5353
{
5454
_fileService = fileService;
55-
_specCodingConfiguration = new SpecCodingConfiguration();
55+
_specCodingConfiguration = new SpecCodingConfiguration();
5656
_logger = logger;
5757
_templateCache = new Dictionary<string, string>();
5858
}

src/SpecCodingMcpServer/Services/SessionManager.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@ public class SessionManager : ISessionManager
5151
{
5252
// Configuration settings for the session manager
5353
private readonly SpecCodingConfiguration _specCodingConfiguration;
54-
54+
5555
// In-memory storage for active sessions
5656
private readonly Dictionary<string, SessionState> _sessions;
57-
57+
5858
// Logger for diagnostic and error messages
5959
private readonly ILogger<SessionManager> _logger;
60-
60+
6161
// Timeout duration for session expiration
6262
private readonly TimeSpan _sessionTimeout;
63-
63+
6464
// Timer for periodic cleanup of expired sessions
6565
private readonly Timer _cleanupTimer;
6666

@@ -71,7 +71,7 @@ public class SessionManager : ISessionManager
7171
/// <param name="logger">The logger instance for diagnostic messages.</param>
7272
public SessionManager(ILogger<SessionManager> logger)
7373
{
74-
_specCodingConfiguration = new SpecCodingConfiguration();
74+
_specCodingConfiguration = new SpecCodingConfiguration();
7575
_sessions = new Dictionary<string, SessionState>();
7676
_logger = logger;
7777

src/SpecCodingMcpServer/Tools/DesignConfirmedTool.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ public class DesignConfirmedTool
1818
{
1919
// Service for managing session state and validation
2020
private readonly ISessionManager _sessionManager;
21-
21+
2222
// Service for file operations (unused in this tool but injected)
2323
private readonly IFileService _fileService;
24-
24+
2525
// Configuration settings for output paths
2626
private readonly SpecCodingConfiguration _specCodingConfiguration;
27-
27+
2828
// Logger for diagnostic and error messages
2929
private readonly ILogger<FeatureConfirmedTool> _logger;
30-
30+
3131
// Service for loading and processing prompt templates
3232
private readonly IContextManager _contextManager;
3333

@@ -89,7 +89,7 @@ public async Task<string> SpecCodingDesignConfirmed(
8989

9090
// Load the task creation prompt template
9191
var template = await _contextManager.LoadPromptAsync("FeatureDesignDocumentConfirmed.md");
92-
92+
9393
// Process template with session context
9494
var result = _contextManager.GetPrompt(template, new Dictionary<string, object>
9595
{
@@ -105,5 +105,5 @@ public async Task<string> SpecCodingDesignConfirmed(
105105
throw new InvalidOperationException("Error executing requirements confirmation", ex);
106106
}
107107
}
108-
108+
109109
}

src/SpecCodingMcpServer/Tools/DesignStartTool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public async Task<string> SpecCodingDesignStart(
6969

7070
// Load the design document creation prompt
7171
var template = await _contextManager.LoadPromptAsync("CreateFeatureDesignDocument.md");
72-
72+
7373
// Process template with feature-specific context
7474
var result = _contextManager.GetPrompt(template, new Dictionary<string, object>
7575
{

src/SpecCodingMcpServer/Tools/FeatureConfirmedTool.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Microsoft.Extensions.Logging;
22
using Microsoft.Extensions.Options;
33
using ModelContextProtocol.Server;
4+
using Serilog;
45
using SpecCodingMcpServer.Exceptions;
56
using SpecCodingMcpServer.Models;
67
using SpecCodingMcpServer.Services;
@@ -53,7 +54,6 @@ public async Task<string> SpecCodingFeatureConfirmed(
5354
{
5455
Log.Information($"Feature confirmed for session {sessionId} with feature: {featureName}");
5556

56-
// 验证会话存在并更新状态
5757
var sessionState = _sessionManager.GetSession(sessionId);
5858
if (sessionState == null)
5959
{
@@ -63,7 +63,7 @@ public async Task<string> SpecCodingFeatureConfirmed(
6363
sessionState.CurrentStage = WorkflowStage.RequirementsGathering;
6464
sessionState.UpdatedAt = DateTime.UtcNow;
6565
_sessionManager.UpdateSession(sessionId, sessionState);
66-
66+
6767

6868
var template = await _contextManager.LoadPromptAsync("FeatureConfirmed.md");
6969
var result = _contextManager.GetPrompt(template, new Dictionary<string, object>

src/SpecCodingMcpServer/Tools/RequirementsConfirmedTool.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace SpecCodingMcpServer.Tools;
1212

13-
public class RequirementsConfirmedTool
13+
public class RequirementsConfirmedTool
1414
{
1515
private readonly ISessionManager _sessionManager;
1616
private readonly IFileService _fileService;
@@ -22,17 +22,17 @@ public RequirementsConfirmedTool(
2222
ISessionManager sessionManager,
2323
IFileService fileService,
2424
IContextManager contextManager,
25-
25+
2626
ILogger<FeatureConfirmedTool> logger)
2727
{
2828
_sessionManager = sessionManager;
2929
_fileService = fileService;
30-
_specCodingConfiguration = new SpecCodingConfiguration();
31-
_logger= logger;
32-
_contextManager=contextManager;
30+
_specCodingConfiguration = new SpecCodingConfiguration();
31+
_logger = logger;
32+
_contextManager = contextManager;
3333
}
34-
35-
34+
35+
3636
[McpServerTool]
3737
[Description("Confirm the completion of the requirements document and proceed to the design phase")]
3838
public async Task<string> SpecCodingRequirementsConfirmed(
@@ -41,11 +41,11 @@ public async Task<string> SpecCodingRequirementsConfirmed(
4141
{
4242
try
4343
{
44-
4544

46-
Log.Information($"Requirements confirmed for session {sessionId} {featureName}" );
4745

48-
46+
Log.Information($"Requirements confirmed for session {sessionId} {featureName}");
47+
48+
4949
var sessionState = _sessionManager.GetSession(sessionId);
5050
if (sessionState == null)
5151
{
@@ -55,8 +55,8 @@ public async Task<string> SpecCodingRequirementsConfirmed(
5555
if (sessionState.CurrentStage != WorkflowStage.RequirementsGathering)
5656
{
5757
throw new WorkflowException(WorkflowStage.RequirementsGathering.ToString(), sessionId);
58-
}
59-
58+
}
59+
6060
sessionState.CurrentStage = WorkflowStage.CreateFeatureDesignDocument;
6161
sessionState.UpdatedAt = DateTime.UtcNow;
6262
_sessionManager.UpdateSession(sessionId, sessionState);
@@ -75,5 +75,5 @@ public async Task<string> SpecCodingRequirementsConfirmed(
7575
Log.Fatal(ex, "Error executing requirements confirmation");
7676
throw new InvalidOperationException("Error executing requirements confirmation", ex);
7777
}
78-
}
78+
}
7979
}

src/SpecCodingMcpServer/Tools/RequirementsStartTool.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public async Task<string> SpecCodingRequirementsStart(
5050
[Description("Session Id")] string sessionId,
5151
[Description("Feature Name based on the confirmed feature")] string featureName)
5252
{
53-
try{
53+
try
54+
{
5455
Log.Information($"Starting requirements gathering for session {sessionId} {featureName}");
5556

5657
var sessionState = _sessionManager.GetSession(sessionId);
@@ -59,18 +60,18 @@ public async Task<string> SpecCodingRequirementsStart(
5960
throw new SessionNotFoundException(sessionId);
6061
}
6162

62-
if (sessionState.CurrentStage != WorkflowStage.RequirementsGathering)
63-
{
64-
throw new WorkflowException(WorkflowStage.RequirementsGathering.ToString(), sessionId);
65-
}
63+
if (sessionState.CurrentStage != WorkflowStage.RequirementsGathering)
64+
{
65+
throw new WorkflowException(WorkflowStage.RequirementsGathering.ToString(), sessionId);
66+
}
6667

6768
var template = await _contextManager.LoadPromptAsync("RequirementsGathering.md");
6869
var result = _contextManager.GetPrompt(template, new Dictionary<string, object>
6970
{
7071
{ "session_id", sessionState.SessionId },
7172
{ "feature_name", sessionState.FeatureName },
7273
{ "feature_folder", $"{_specCodingConfiguration.OutputPath}/features/{featureName}" }
73-
});
74+
});
7475
return result;
7576
}
7677
catch (Exception ex)

0 commit comments

Comments
 (0)