Research conducted on modern AI coding assistants (Cursor, GitHub Copilot, Cline,
Aider, Windsurf, Replit Agent) to understand architecture patterns, context management,
code editing workflows, and tool use protocols.
Key Decision: Pivoted from building full CLI (40-50h) to validation-driven MCP-first
approach (10-15h). Build 5 core CODEX MCP tools that work with ANY coding assistant,
validate adoption over 2-4 weeks, then decide on full CLI if demand proven.
Files:
- research/ai-systems/modern-coding-assistants-architecture.md (comprehensive research)
- research/ai-systems/codex-coding-assistant-implementation-plan.md (original CLI plan, preserved)
- research/ai-systems/codex-mcp-tools-implementation-plan.md (approved MCP-first plan)
- ideas/registry.json (updated with approved MCP tools proposal)
Architech Validation: APPROVED with pivot to MCP-first approach
Human Decision: Approved (pragmatic validation-driven development)
Next: Begin Phase 1 implementation (10-15 hours, 5 core MCP tools)
🤖 Generated with CODEX Research System
Co-Authored-By: The Archivist <archivist@codex.svrnty.io>
Co-Authored-By: The Architech <architech@codex.svrnty.io>
Co-Authored-By: Mathias Beaulieu-Duncan <mat@svrnty.io>
89 lines
2.6 KiB
C#
89 lines
2.6 KiB
C#
using Xunit;
|
|
using Moq;
|
|
using OpenHarbor.MCP.Gateway.Core.Interfaces;
|
|
using OpenHarbor.MCP.Gateway.Core.Models;
|
|
|
|
namespace OpenHarbor.MCP.Gateway.Core.Tests.Infrastructure;
|
|
|
|
/// <summary>
|
|
/// Unit tests for IServerTransport interface following TDD approach.
|
|
/// Tests transport communication contract.
|
|
/// </summary>
|
|
public class IServerTransportTests
|
|
{
|
|
[Fact]
|
|
public async Task SendRequestAsync_WithValidRequest_ReturnsResponse()
|
|
{
|
|
// Arrange
|
|
var mockTransport = new Mock<IServerTransport>();
|
|
var request = new GatewayRequest
|
|
{
|
|
ToolName = "test_tool",
|
|
Arguments = new Dictionary<string, object> { { "key", "value" } }
|
|
};
|
|
var expectedResponse = new GatewayResponse
|
|
{
|
|
Success = true,
|
|
Result = new Dictionary<string, object> { { "data", "result" } }
|
|
};
|
|
|
|
mockTransport
|
|
.Setup(t => t.SendRequestAsync(It.IsAny<GatewayRequest>(), It.IsAny<CancellationToken>()))
|
|
.ReturnsAsync(expectedResponse);
|
|
|
|
// Act
|
|
var response = await mockTransport.Object.SendRequestAsync(request, CancellationToken.None);
|
|
|
|
// Assert
|
|
Assert.NotNull(response);
|
|
Assert.True(response.Success);
|
|
mockTransport.Verify(t => t.SendRequestAsync(request, It.IsAny<CancellationToken>()), Times.Once);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task ConnectAsync_OpensConnection()
|
|
{
|
|
// Arrange
|
|
var mockTransport = new Mock<IServerTransport>();
|
|
mockTransport
|
|
.Setup(t => t.ConnectAsync(It.IsAny<CancellationToken>()))
|
|
.Returns(Task.CompletedTask);
|
|
|
|
// Act
|
|
await mockTransport.Object.ConnectAsync(CancellationToken.None);
|
|
|
|
// Assert
|
|
mockTransport.Verify(t => t.ConnectAsync(It.IsAny<CancellationToken>()), Times.Once);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task DisconnectAsync_ClosesConnection()
|
|
{
|
|
// Arrange
|
|
var mockTransport = new Mock<IServerTransport>();
|
|
mockTransport
|
|
.Setup(t => t.DisconnectAsync(It.IsAny<CancellationToken>()))
|
|
.Returns(Task.CompletedTask);
|
|
|
|
// Act
|
|
await mockTransport.Object.DisconnectAsync(CancellationToken.None);
|
|
|
|
// Assert
|
|
mockTransport.Verify(t => t.DisconnectAsync(It.IsAny<CancellationToken>()), Times.Once);
|
|
}
|
|
|
|
[Fact]
|
|
public void IsConnected_ReturnsConnectionState()
|
|
{
|
|
// Arrange
|
|
var mockTransport = new Mock<IServerTransport>();
|
|
mockTransport.Setup(t => t.IsConnected).Returns(true);
|
|
|
|
// Act
|
|
var isConnected = mockTransport.Object.IsConnected;
|
|
|
|
// Assert
|
|
Assert.True(isConnected);
|
|
}
|
|
}
|