diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..bdca33b
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,25 @@
+**/.classpath
+**/.dockerignore
+**/.env
+**/.git
+**/.gitignore
+**/.project
+**/.settings
+**/.toolstarget
+**/.vs
+**/.vscode
+**/*.*proj.user
+**/*.dbmdl
+**/*.jfm
+**/azds.yaml
+**/bin
+**/charts
+**/docker-compose*
+**/Dockerfile*
+**/node_modules
+**/npm-debug.log
+**/obj
+**/secrets.dev.yaml
+**/values.dev.yaml
+LICENSE
+README.md
\ No newline at end of file
diff --git a/Daemon/Peer.Daemon.Linux/Dockerfile b/Daemon/Peer.Daemon.Linux/Dockerfile
new file mode 100644
index 0000000..fe307a4
--- /dev/null
+++ b/Daemon/Peer.Daemon.Linux/Dockerfile
@@ -0,0 +1,22 @@
+#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
+
+FROM mcr.microsoft.com/dotnet/aspnet:8.0-preview AS base
+WORKDIR /app
+EXPOSE 80
+EXPOSE 443
+
+FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS build
+WORKDIR /src
+COPY ["Peer.Daemon/Peer.Daemon.Linux.csproj", "Peer.Daemon/"]
+RUN dotnet restore "Peer.Daemon/Peer.Daemon.Linux.csproj"
+COPY . .
+WORKDIR "/src/Peer.Daemon"
+RUN dotnet build "Peer.Daemon.Linux.csproj" -c Release -o /app/build
+
+FROM build AS publish
+RUN dotnet publish "Peer.Daemon.Linux.csproj" -c Release -o /app/publish /p:UseAppHost=false
+
+FROM base AS final
+WORKDIR /app
+COPY --from=publish /app/publish .
+ENTRYPOINT ["dotnet", "Peer.Daemon.Linux.dll"]
\ No newline at end of file
diff --git a/Daemon/Peer.Daemon.Linux/Peer.Daemon.Linux.csproj b/Daemon/Peer.Daemon.Linux/Peer.Daemon.Linux.csproj
new file mode 100644
index 0000000..f3a4214
--- /dev/null
+++ b/Daemon/Peer.Daemon.Linux/Peer.Daemon.Linux.csproj
@@ -0,0 +1,34 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+ a72c40e5-9101-4d72-a095-e1834bf03f06
+ Linux
+ ..\docker-compose.dcproj
+
+
+
+ true
+ true
+ copyused
+ true
+ true
+ True
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
diff --git a/Daemon/Peer.Daemon.Linux/Program.cs b/Daemon/Peer.Daemon.Linux/Program.cs
new file mode 100644
index 0000000..9d439f2
--- /dev/null
+++ b/Daemon/Peer.Daemon.Linux/Program.cs
@@ -0,0 +1,28 @@
+using Microsoft.AspNetCore.Server.Kestrel.Core;
+using Peer.Server;
+
+namespace Peer.Daemon.Linux
+{
+ internal class Program
+ {
+ private const string _socketPath = "/var/run/peerless/peerless.sock";
+ static async Task Main()
+ {
+ Directory.CreateDirectory(Directory.GetParent(_socketPath)!.FullName);
+ File.Delete(_socketPath);
+
+ var app = ServerBuilder.CreateHost(cfg =>
+ {
+ cfg.WebHost.UseKestrel(kestrel =>
+ {
+ kestrel.ListenUnixSocket(_socketPath, opts =>
+ {
+ opts.Protocols = HttpProtocols.Http2;
+ });
+ });
+ });
+
+ await app.RunAsync();
+ }
+ }
+}
diff --git a/Daemon/Peer.Daemon.Linux/Properties/launchSettings.json b/Daemon/Peer.Daemon.Linux/Properties/launchSettings.json
new file mode 100644
index 0000000..22f8c57
--- /dev/null
+++ b/Daemon/Peer.Daemon.Linux/Properties/launchSettings.json
@@ -0,0 +1,18 @@
+{
+ "profiles": {
+ "Peer.Daemon.Linux": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ },
+ "applicationUrl": "https://localhost:59768;http://localhost:59769"
+ },
+ "Docker": {
+ "commandName": "Docker",
+ "launchBrowser": false,
+ "publishAllPorts": true,
+ "useSSL": false
+ }
+ }
+}
\ No newline at end of file
diff --git a/Daemon/Peer.Daemon.Windows/Peer.Daemon.Windows.csproj b/Daemon/Peer.Daemon.Windows/Peer.Daemon.Windows.csproj
new file mode 100644
index 0000000..c249a65
--- /dev/null
+++ b/Daemon/Peer.Daemon.Windows/Peer.Daemon.Windows.csproj
@@ -0,0 +1,22 @@
+
+
+ net8.0
+ enable
+ enable
+ true
+
+
+
+ true
+ true
+ copyused
+ true
+ true
+ True
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Daemon/Peer.Daemon.Windows/Program.cs b/Daemon/Peer.Daemon.Windows/Program.cs
new file mode 100644
index 0000000..6e4a9f5
--- /dev/null
+++ b/Daemon/Peer.Daemon.Windows/Program.cs
@@ -0,0 +1,23 @@
+using Microsoft.AspNetCore.Server.Kestrel.Core;
+using Peer.Server;
+
+namespace Peer.Daemon.Windows;
+
+public class Program
+{
+ public async static Task Main(string[] args)
+ {
+ var app = ServerBuilder.CreateHost(builder =>
+ {
+ builder.WebHost.UseKestrel(x =>
+ {
+ x.ListenNamedPipe("peerless", opts =>
+ {
+ opts.Protocols = HttpProtocols.Http2;
+ });
+ });
+ });
+
+ await app.RunAsync();
+ }
+}
diff --git a/Daemon/Peer.Daemon.Windows/Properties/launchSettings.json b/Daemon/Peer.Daemon.Windows/Properties/launchSettings.json
new file mode 100644
index 0000000..cf7cbdc
--- /dev/null
+++ b/Daemon/Peer.Daemon.Windows/Properties/launchSettings.json
@@ -0,0 +1,12 @@
+{
+ "$schema": "http://json.schemastore.org/launchsettings.json",
+ "profiles": {
+ "http": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ }
+ }
+}
diff --git a/Daemon/Peer.Daemon.Windows/appsettings.Development.json b/Daemon/Peer.Daemon.Windows/appsettings.Development.json
new file mode 100644
index 0000000..ac2fb5f
--- /dev/null
+++ b/Daemon/Peer.Daemon.Windows/appsettings.Development.json
@@ -0,0 +1,8 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Trace"
+ }
+ }
+}
diff --git a/Daemon/Peer.Daemon.Windows/appsettings.json b/Daemon/Peer.Daemon.Windows/appsettings.json
new file mode 100644
index 0000000..10f68b8
--- /dev/null
+++ b/Daemon/Peer.Daemon.Windows/appsettings.json
@@ -0,0 +1,9 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "AllowedHosts": "*"
+}
diff --git a/Geas/Geas.csproj b/Geas/Geas.csproj
new file mode 100644
index 0000000..a07194b
--- /dev/null
+++ b/Geas/Geas.csproj
@@ -0,0 +1,24 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+ true
+ true
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
diff --git a/Geas/Program.cs b/Geas/Program.cs
new file mode 100644
index 0000000..444217c
--- /dev/null
+++ b/Geas/Program.cs
@@ -0,0 +1,62 @@
+using System.IO.Pipes;
+using System.Security.Principal;
+using Grpc.Net.Client;
+using Peerless;
+
+namespace Geas;
+
+internal class Program
+{
+ public string[] _commands = { "prs" };
+ public string[] _modes = { "unix", "windows" };
+ static async Task Main(string[] args)
+ {
+ var factory = new NamedPipeConnectionFactory("peerless");
+
+ var handler = new SocketsHttpHandler()
+ {
+ ConnectCallback = factory.ConnectAsync
+ };
+
+ var channel = GrpcChannel.ForAddress("http://pipe:/peerless", new GrpcChannelOptions
+ {
+ HttpHandler = handler
+ });
+
+ var client = new PullRequestGrpcService.PullRequestGrpcServiceClient(channel);
+ var res = client.GetPullRequest(new GetPullRequestRequest { Id = 1 });
+ await Console.Out.WriteLineAsync($"Found: {res.Value.Id}");
+ }
+}
+
+public class NamedPipeConnectionFactory
+{
+ private readonly string _pipeName;
+
+ public NamedPipeConnectionFactory(string pipeName)
+ {
+ _pipeName = pipeName;
+ }
+
+ public async ValueTask ConnectAsync(SocketsHttpConnectionContext _,
+ CancellationToken cancellationToken = default)
+ {
+ var clientStream = new NamedPipeClientStream(
+ serverName: ".",
+ pipeName: _pipeName,
+ direction: PipeDirection.InOut,
+ options: PipeOptions.WriteThrough | PipeOptions.Asynchronous,
+ impersonationLevel: TokenImpersonationLevel.Anonymous);
+
+ try
+ {
+ await clientStream.ConnectAsync(cancellationToken).ConfigureAwait(false);
+ return clientStream;
+ }
+ catch
+ {
+ clientStream.Dispose();
+ throw;
+ }
+ }
+}
diff --git a/Peer.Domain/Commands/FindError.cs b/Peer.Domain/Commands/FindError.cs
deleted file mode 100644
index 2ce7611..0000000
--- a/Peer.Domain/Commands/FindError.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Peer.Domain.Commands
-{
- public enum FindError
- {
- AmbiguousMatch,
- NotFound
- }
-}
diff --git a/Peer.Domain/Commands/ShowArguments.cs b/Peer.Domain/Commands/ShowArguments.cs
deleted file mode 100644
index 6c271ef..0000000
--- a/Peer.Domain/Commands/ShowArguments.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace Peer.Domain.Commands
-{
- public class ShowArguments
- {
- public int Count { get; }
- public ShowArguments(int count)
- {
- Count = count;
- }
- }
-}
diff --git a/Peer.Domain/Configuration/RegistrationError.cs b/Peer.Domain/Configuration/RegistrationError.cs
index 34a5d41..05ed022 100644
--- a/Peer.Domain/Configuration/RegistrationError.cs
+++ b/Peer.Domain/Configuration/RegistrationError.cs
@@ -1,9 +1,8 @@
-namespace Peer.Domain.Configuration
+namespace Peer.Domain.Configuration;
+
+public enum RegistrationError
{
- public enum RegistrationError
- {
- Fire,
- ProviderMismatch,
- BadConfig,
- }
+ Fire,
+ ProviderMismatch,
+ BadConfig,
}
diff --git a/Peer.Domain/Exceptions/FetchException.cs b/Peer.Domain/Exceptions/FetchException.cs
index c21cc61..15df7e2 100644
--- a/Peer.Domain/Exceptions/FetchException.cs
+++ b/Peer.Domain/Exceptions/FetchException.cs
@@ -1,5 +1,4 @@
using System;
-using System.Runtime.Serialization;
namespace Peer.Domain.Exceptions
{
@@ -10,7 +9,5 @@ public FetchException() { }
public FetchException(string? message) : base(message) { }
public FetchException(string? message, Exception? innerException) : base(message, innerException) { }
-
- protected FetchException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
diff --git a/Peer.Domain/Exceptions/UnreachableException.cs b/Peer.Domain/Exceptions/UnreachableException.cs
index f89e9c6..1d0a7c8 100644
--- a/Peer.Domain/Exceptions/UnreachableException.cs
+++ b/Peer.Domain/Exceptions/UnreachableException.cs
@@ -11,7 +11,6 @@ public UnreachableException()
}
protected UnreachableException(SerializationInfo info, StreamingContext context)
- : base(info, context)
{
}
}
diff --git a/Peer.Domain/IPullRequestService.cs b/Peer.Domain/IPullRequestService.cs
index 0f1e778..c8156ec 100644
--- a/Peer.Domain/IPullRequestService.cs
+++ b/Peer.Domain/IPullRequestService.cs
@@ -1,14 +1,18 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
-using Peer.Domain.Commands;
using wimm.Secundatives;
-namespace Peer.Domain
+namespace Peer.Domain;
+
+public interface IPullRequestService
+{
+ IAsyncEnumerable FetchAllPullRequests(CancellationToken token = default);
+ Task> FindSingleByPartial(PartialIdentifier partial, CancellationToken token = default);
+}
+
+public enum FindError
{
- public interface IPullRequestService
- {
- IAsyncEnumerable FetchAllPullRequests(CancellationToken token = default);
- Task> FindSingleByPartial(PartialIdentifier partial, CancellationToken token = default);
- }
+ AmbiguousMatch,
+ NotFound
}
diff --git a/Peer.Domain/Peer.Domain.csproj b/Peer.Domain/Peer.Domain.csproj
index 42ae277..86c3014 100644
--- a/Peer.Domain/Peer.Domain.csproj
+++ b/Peer.Domain/Peer.Domain.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net8.0
enable
Debug;Release;Tool
true
@@ -12,14 +12,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/Peer.Domain/PullRequestService.cs b/Peer.Domain/PullRequestService.cs
index fd7eddf..eb58deb 100644
--- a/Peer.Domain/PullRequestService.cs
+++ b/Peer.Domain/PullRequestService.cs
@@ -2,7 +2,6 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-using Peer.Domain.Commands;
using Peer.Domain.Util;
using wimm.Secundatives;
diff --git a/Peer.Domain/Util/Validators.cs b/Peer.Domain/Util/Validators.cs
index b2bfad2..8a88bcd 100644
--- a/Peer.Domain/Util/Validators.cs
+++ b/Peer.Domain/Util/Validators.cs
@@ -14,13 +14,13 @@ public class Validators
public const string NotEmpty = "Cannot be empty";
public const string UndefinedEnum = "Enum value cannot be undefined";
- public static void ArgNotLessThanOrEqualToZero(int value, [CallerArgumentExpression("value")] string? name = null)
+ public static void ArgNotLessThanOrEqualToZero(int value, [CallerArgumentExpression(nameof(value))] string? name = null)
{
if (value <= 0)
throw new ArgumentException(NotLessThanOrEqualToZero, name);
}
- public static void ArgIsNotNullEmptyOrWhitespace(string value, [CallerArgumentExpression("value")] string? name = null)
+ public static void ArgIsNotNullEmptyOrWhitespace(string value, [CallerArgumentExpression(nameof(value))] string? name = null)
{
if (value == null)
throw new ArgumentNullException(name);
@@ -29,31 +29,31 @@ public static void ArgIsNotNullEmptyOrWhitespace(string value, [CallerArgumentEx
throw new ArgumentException(NotEmptyOrWhitespace, name);
}
- public static void ArgIsNotNull(object value, [CallerArgumentExpression("value")] string? name = null)
+ public static void ArgIsNotNull(object value, [CallerArgumentExpression(nameof(value))] string? name = null)
{
if (value == null)
throw new ArgumentNullException(name);
}
- public static void ArgIsNotEmpty(Guid value, [CallerArgumentExpression("value")] string? name = null)
+ public static void ArgIsNotEmpty(Guid value, [CallerArgumentExpression(nameof(value))] string? name = null)
{
if (value == Guid.Empty)
throw new ArgumentException(NotGuidEmpty, name);
}
- public static void ArgIsNotEmpty(ICollection collection, [CallerArgumentExpression("collection")] string? name = null)
+ public static void ArgIsNotEmpty(ICollection collection, [CallerArgumentExpression(nameof(collection))] string? name = null)
{
if (collection?.Count == 0)
throw new ArgumentException(NotEmpty, name);
}
- public static void ArgIsNotNullOrEmpty(ICollection collection, [CallerArgumentExpression("collection")] string? name = null)
+ public static void ArgIsNotNullOrEmpty(ICollection collection, [CallerArgumentExpression(nameof(collection))] string? name = null)
{
ArgIsNotNull(collection, name);
ArgIsNotEmpty(collection, name);
}
- public static void ArgIsDefined(T value, [CallerArgumentExpression("value")] string? name = null) where T : struct, Enum
+ public static void ArgIsDefined(T value, [CallerArgumentExpression(nameof(value))] string? name = null) where T : struct, Enum
{
if (!Enum.IsDefined(value))
throw new ArgumentException(UndefinedEnum, name);
diff --git a/Peer.GitHub/GitHubWebRegistrationHandler.cs b/Peer.GitHub/GitHubWebRegistrationHandler.cs
index aebe0ca..25a37b1 100644
--- a/Peer.GitHub/GitHubWebRegistrationHandler.cs
+++ b/Peer.GitHub/GitHubWebRegistrationHandler.cs
@@ -19,7 +19,8 @@ public class GitHubWebRegistrationHandler : IRegistrationHandler
public Result Register(IConfigurationSection config, IServiceCollection services)
{
var childConfigs = config.GetChildren().Select(x => x.Get())
- .Select(x => x.Into())
+ .Where(x => x != null)
+ .Select(x => x!.Into())
.Collect();
if (childConfigs.IsError)
diff --git a/Peer.GitHub/GraphQL/PullRequestSearch/ReviewThread.cs b/Peer.GitHub/GraphQL/PullRequestSearch/ReviewThread.cs
index f46757f..6da325a 100644
--- a/Peer.GitHub/GraphQL/PullRequestSearch/ReviewThread.cs
+++ b/Peer.GitHub/GraphQL/PullRequestSearch/ReviewThread.cs
@@ -1,9 +1,7 @@
namespace Peer.GitHub.GraphQL.PullRequestSearch
{
-#nullable disable
public class ReviewThread
{
public bool IsResolved { get; set; }
}
-#nullable enable
}
diff --git a/Peer.GitHub/Peer.GitHub.csproj b/Peer.GitHub/Peer.GitHub.csproj
index 20ae2c9..52bceaa 100644
--- a/Peer.GitHub/Peer.GitHub.csproj
+++ b/Peer.GitHub/Peer.GitHub.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net8.0
disable
enable
Debug;Release;Tool
@@ -13,7 +13,7 @@
-
+
diff --git a/Peer.UnitTests/Apps/AppBuilderTests.cs b/Peer.UnitTests/Apps/AppBuilderTests.cs
index cb062f4..ec11980 100644
--- a/Peer.UnitTests/Apps/AppBuilderTests.cs
+++ b/Peer.UnitTests/Apps/AppBuilderTests.cs
@@ -5,7 +5,7 @@
using Microsoft.Extensions.DependencyInjection;
using Peer.Apps;
using Peer.Apps.AppBuilder;
-using Peer.Domain.Configuration;
+using Peer.Configuration;
using wimm.Secundatives;
using Xunit;
@@ -93,7 +93,6 @@ public void TypeIsAnnotatedWithVerbAttribute_Succeeds()
}
}
-
private AppBuilder Construct()
{
_services = new ServiceCollection();
diff --git a/Peer.UnitTests/Formatters/CompactFormatterTests.cs b/Peer.UnitTests/Formatters/CompactFormatterTests.cs
index d8f9630..d20f6fa 100644
--- a/Peer.UnitTests/Formatters/CompactFormatterTests.cs
+++ b/Peer.UnitTests/Formatters/CompactFormatterTests.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using Peer.Domain;
-using Peer.Domain.Formatters;
+using Peer.Formatters;
using Peer.UnitTests.Util;
using Xunit;
diff --git a/Peer.UnitTests/Formatters/DetailsFormatterTests.cs b/Peer.UnitTests/Formatters/DetailsFormatterTests.cs
index aea9f5b..eb0ca12 100644
--- a/Peer.UnitTests/Formatters/DetailsFormatterTests.cs
+++ b/Peer.UnitTests/Formatters/DetailsFormatterTests.cs
@@ -1,7 +1,6 @@
using System;
using Moq;
-using Peer.Domain;
-using Peer.Domain.Commands;
+using Peer.Commands;
using Peer.UnitTests.Util;
using Xunit;
diff --git a/Peer.UnitTests/Parsing/FilterParserTests.cs b/Peer.UnitTests/Parsing/FilterParserTests.cs
index bfc9693..4ed4d99 100644
--- a/Peer.UnitTests/Parsing/FilterParserTests.cs
+++ b/Peer.UnitTests/Parsing/FilterParserTests.cs
@@ -1,6 +1,6 @@
using System;
using Peer.Domain;
-using Peer.Domain.Filters;
+using Peer.Filters;
using Peer.Parsing;
using Peer.UnitTests.Util;
using Xunit;
diff --git a/Peer.UnitTests/Peer.UnitTests.csproj b/Peer.UnitTests/Peer.UnitTests.csproj
index dbaff7c..8189790 100644
--- a/Peer.UnitTests/Peer.UnitTests.csproj
+++ b/Peer.UnitTests/Peer.UnitTests.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net8.0
false
@@ -9,18 +9,18 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
+
+
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
diff --git a/Peer.Utils/Peer.Utils.csproj b/Peer.Utils/Peer.Utils.csproj
index cefe53c..31a5705 100644
--- a/Peer.Utils/Peer.Utils.csproj
+++ b/Peer.Utils/Peer.Utils.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net8.0
Debug;Release;Tool
diff --git a/Peer.sln b/Peer.sln
index e5280f0..92e010f 100644
--- a/Peer.sln
+++ b/Peer.sln
@@ -18,6 +18,22 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
EndProjectSection
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Peer.Daemon.Windows", "Daemon\Peer.Daemon.Windows\Peer.Daemon.Windows.csproj", "{DB618981-AFE1-4D09-B77A-38AF016F771F}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Peer.Daemon.Linux", "Daemon\Peer.Daemon.Linux\Peer.Daemon.Linux.csproj", "{93E57E8B-D1F8-42CA-8F12-F8A1D7A3517D}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Geas", "Geas\Geas.csproj", "{7192E310-4B50-4E14-9EDC-D8D7E3962841}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Server", "Server", "{CBEEB143-52E8-4270-B4AD-74D5EFFFBF59}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Daemon", "Daemon", "{A4028D8C-A3E4-4C53-9ECB-32B45DB17AB8}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Peer.Server", "Server\Peer.Server\Peer.Server.csproj", "{6E9324E8-AD03-4F1B-8F1E-308B0E209A48}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Peer.Grpc", "Server\Peer.Grpc\Peer.Grpc.csproj", "{776CEF4E-530A-49BC-A88C-473A192E3949}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Peer.Server.Persistence", "Server\Peer.Server.Persistence\Peer.Server.Persistence.csproj", "{04622613-ACDD-41B5-A4F2-0075157E72B3}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -55,10 +71,53 @@ Global
{A6919FD7-65B9-48E2-BF29-C6942A0DDA3A}.Release|Any CPU.Build.0 = Release|Any CPU
{A6919FD7-65B9-48E2-BF29-C6942A0DDA3A}.Tool|Any CPU.ActiveCfg = Tool|Any CPU
{A6919FD7-65B9-48E2-BF29-C6942A0DDA3A}.Tool|Any CPU.Build.0 = Tool|Any CPU
+ {DB618981-AFE1-4D09-B77A-38AF016F771F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DB618981-AFE1-4D09-B77A-38AF016F771F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DB618981-AFE1-4D09-B77A-38AF016F771F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DB618981-AFE1-4D09-B77A-38AF016F771F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DB618981-AFE1-4D09-B77A-38AF016F771F}.Tool|Any CPU.ActiveCfg = Debug|Any CPU
+ {DB618981-AFE1-4D09-B77A-38AF016F771F}.Tool|Any CPU.Build.0 = Debug|Any CPU
+ {93E57E8B-D1F8-42CA-8F12-F8A1D7A3517D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {93E57E8B-D1F8-42CA-8F12-F8A1D7A3517D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {93E57E8B-D1F8-42CA-8F12-F8A1D7A3517D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {93E57E8B-D1F8-42CA-8F12-F8A1D7A3517D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {93E57E8B-D1F8-42CA-8F12-F8A1D7A3517D}.Tool|Any CPU.ActiveCfg = Debug|Any CPU
+ {93E57E8B-D1F8-42CA-8F12-F8A1D7A3517D}.Tool|Any CPU.Build.0 = Debug|Any CPU
+ {7192E310-4B50-4E14-9EDC-D8D7E3962841}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7192E310-4B50-4E14-9EDC-D8D7E3962841}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7192E310-4B50-4E14-9EDC-D8D7E3962841}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7192E310-4B50-4E14-9EDC-D8D7E3962841}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7192E310-4B50-4E14-9EDC-D8D7E3962841}.Tool|Any CPU.ActiveCfg = Debug|Any CPU
+ {7192E310-4B50-4E14-9EDC-D8D7E3962841}.Tool|Any CPU.Build.0 = Debug|Any CPU
+ {6E9324E8-AD03-4F1B-8F1E-308B0E209A48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6E9324E8-AD03-4F1B-8F1E-308B0E209A48}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6E9324E8-AD03-4F1B-8F1E-308B0E209A48}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6E9324E8-AD03-4F1B-8F1E-308B0E209A48}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6E9324E8-AD03-4F1B-8F1E-308B0E209A48}.Tool|Any CPU.ActiveCfg = Debug|Any CPU
+ {6E9324E8-AD03-4F1B-8F1E-308B0E209A48}.Tool|Any CPU.Build.0 = Debug|Any CPU
+ {776CEF4E-530A-49BC-A88C-473A192E3949}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {776CEF4E-530A-49BC-A88C-473A192E3949}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {776CEF4E-530A-49BC-A88C-473A192E3949}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {776CEF4E-530A-49BC-A88C-473A192E3949}.Release|Any CPU.Build.0 = Release|Any CPU
+ {776CEF4E-530A-49BC-A88C-473A192E3949}.Tool|Any CPU.ActiveCfg = Debug|Any CPU
+ {776CEF4E-530A-49BC-A88C-473A192E3949}.Tool|Any CPU.Build.0 = Debug|Any CPU
+ {04622613-ACDD-41B5-A4F2-0075157E72B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {04622613-ACDD-41B5-A4F2-0075157E72B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {04622613-ACDD-41B5-A4F2-0075157E72B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {04622613-ACDD-41B5-A4F2-0075157E72B3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {04622613-ACDD-41B5-A4F2-0075157E72B3}.Tool|Any CPU.ActiveCfg = Debug|Any CPU
+ {04622613-ACDD-41B5-A4F2-0075157E72B3}.Tool|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {DB618981-AFE1-4D09-B77A-38AF016F771F} = {A4028D8C-A3E4-4C53-9ECB-32B45DB17AB8}
+ {93E57E8B-D1F8-42CA-8F12-F8A1D7A3517D} = {A4028D8C-A3E4-4C53-9ECB-32B45DB17AB8}
+ {6E9324E8-AD03-4F1B-8F1E-308B0E209A48} = {CBEEB143-52E8-4270-B4AD-74D5EFFFBF59}
+ {776CEF4E-530A-49BC-A88C-473A192E3949} = {CBEEB143-52E8-4270-B4AD-74D5EFFFBF59}
+ {04622613-ACDD-41B5-A4F2-0075157E72B3} = {CBEEB143-52E8-4270-B4AD-74D5EFFFBF59}
+ EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CCA67754-334B-4BC0-9477-BE16450CE154}
EndGlobalSection
diff --git a/Peer/Apps/App.cs b/Peer/Apps/App.cs
index 54f4788..fd5ae55 100644
--- a/Peer/Apps/App.cs
+++ b/Peer/Apps/App.cs
@@ -3,14 +3,10 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-using CommandLine;
-using CommandLine.Text;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
-using Newtonsoft.Json.Linq;
using Peer.Apps.AppBuilder;
-using Peer.Domain.Configuration;
-using wimm.Secundatives;
+using Peer.Configuration;
namespace Peer.Apps;
diff --git a/Peer/Apps/AppBuilder/AppBuilder.cs b/Peer/Apps/AppBuilder/AppBuilder.cs
index a6bf77c..ddc60cb 100644
--- a/Peer/Apps/AppBuilder/AppBuilder.cs
+++ b/Peer/Apps/AppBuilder/AppBuilder.cs
@@ -4,7 +4,7 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
-using Peer.Domain.Configuration;
+using Peer.Configuration;
using wimm.Secundatives;
namespace Peer.Apps.AppBuilder;
diff --git a/Peer/Apps/AppBuilder/IRunTimeConfigHandler.cs b/Peer/Apps/AppBuilder/IRunTimeConfigHandler.cs
index b411bf9..5c4e68e 100644
--- a/Peer/Apps/AppBuilder/IRunTimeConfigHandler.cs
+++ b/Peer/Apps/AppBuilder/IRunTimeConfigHandler.cs
@@ -1,6 +1,6 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
-using Peer.Domain.Configuration;
+using Peer.Configuration;
using wimm.Secundatives;
namespace Peer.Apps.AppBuilder;
diff --git a/Peer/Apps/AppBuilder/RunTimeConfigMapping.cs b/Peer/Apps/AppBuilder/RunTimeConfigMapping.cs
index de3f623..d3126cf 100644
--- a/Peer/Apps/AppBuilder/RunTimeConfigMapping.cs
+++ b/Peer/Apps/AppBuilder/RunTimeConfigMapping.cs
@@ -1,6 +1,6 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
-using Peer.Domain.Configuration;
+using Peer.Configuration;
using wimm.Secundatives;
namespace Peer.Apps.AppBuilder;
diff --git a/Peer/Apps/AppBuilder/VerbBuilder.cs b/Peer/Apps/AppBuilder/VerbBuilder.cs
index 5793cc9..cc0a568 100644
--- a/Peer/Apps/AppBuilder/VerbBuilder.cs
+++ b/Peer/Apps/AppBuilder/VerbBuilder.cs
@@ -1,25 +1,18 @@
using System;
-using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
-using Peer.GitHub;
-using Peer.GitHub.GraphQL.PullRequestSearch;
using Peer.Verbs;
namespace Peer.Apps.AppBuilder;
-public class VerbBuilder
+public class VerbBuilder(IServiceCollection services)
{
- private readonly IServiceCollection _services;
- private readonly List _subs = new();
- public VerbBuilder(IServiceCollection services)
- {
- _services = services;
- }
+ private readonly IServiceCollection _services = services;
- public VerbBuilder WithHandler() where THandler : class, IHandler
+ public VerbBuilder WithHandler<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] THandler>() where THandler : class, IHandler
{
_services.AddSingleton, THandler>();
_services.AddSingleton>();
@@ -41,13 +34,14 @@ public VerbBuilder WithSubVerb(Action>? config = null
return this;
}
- public VerbBuilder WithCustomHelp() where THelp : class, IHelpTextFormatter
+ public VerbBuilder WithCustomHelp<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] THelp>() where THelp : class, IHelpTextFormatter
{
_services.AddSingleton, THelp>();
return this;
}
- public VerbBuilder WithRunTimeConfig() where TRegHandler : class, IRunTimeConfigHandler
+ public VerbBuilder WithRunTimeConfig<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TRegHandler>()
+ where TRegHandler : class, IRunTimeConfigHandler
{
_services.TryAddSingleton();
_services.AddSingleton, RunTimeConfigMapping>();
diff --git a/Peer/Apps/FuncServiceSetupHandler.cs b/Peer/Apps/FuncServiceSetupHandler.cs
index 8412d9e..34cb434 100644
--- a/Peer/Apps/FuncServiceSetupHandler.cs
+++ b/Peer/Apps/FuncServiceSetupHandler.cs
@@ -1,6 +1,6 @@
using System;
using Microsoft.Extensions.DependencyInjection;
-using Peer.Domain.Configuration;
+using Peer.Configuration;
using wimm.Secundatives;
namespace Peer.Apps;
diff --git a/Peer/Apps/IServiceSetupHandler.cs b/Peer/Apps/IServiceSetupHandler.cs
index ea972c6..b71a57b 100644
--- a/Peer/Apps/IServiceSetupHandler.cs
+++ b/Peer/Apps/IServiceSetupHandler.cs
@@ -1,5 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
-using Peer.Domain.Configuration;
+using Peer.Configuration;
using wimm.Secundatives;
namespace Peer.Apps;
diff --git a/Peer/Apps/Verb.cs b/Peer/Apps/Verb.cs
index c439742..cd8559c 100644
--- a/Peer/Apps/Verb.cs
+++ b/Peer/Apps/Verb.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Threading;
using CommandLine;
using Peer.Apps.AppBuilder;
using Peer.Verbs;
diff --git a/Peer.Domain/Commands/ConfigEdit.cs b/Peer/Commands/ConfigEdit.cs
similarity index 84%
rename from Peer.Domain/Commands/ConfigEdit.cs
rename to Peer/Commands/ConfigEdit.cs
index 40944c5..1eec437 100644
--- a/Peer.Domain/Commands/ConfigEdit.cs
+++ b/Peer/Commands/ConfigEdit.cs
@@ -3,24 +3,18 @@
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
+using Peer.Domain;
using Peer.Domain.Util;
using wimm.Secundatives;
using wimm.Secundatives.Extensions;
-namespace Peer.Domain.Commands;
+namespace Peer.Commands;
-public class ConfigEdit
+public class ConfigEdit(ConfigEditConfig config, IOSInfoProvider infoProvider, IFileOperations fileOps)
{
- private readonly IOSInfoProvider _infoProvider;
- private readonly ConfigEditConfig _config;
- private readonly IFileOperations _fileOps;
-
- public ConfigEdit(ConfigEditConfig config, IOSInfoProvider infoProvider, IFileOperations fileOps)
- {
- _config = config;
- _infoProvider = infoProvider;
- _fileOps = fileOps;
- }
+ private readonly IOSInfoProvider _infoProvider = infoProvider;
+ private readonly ConfigEditConfig _config = config;
+ private readonly IFileOperations _fileOps = fileOps;
public Task> RunAsync()
{
@@ -38,7 +32,6 @@ private async Task> OpenFileAsync(string path)
? OpenWithOsDefault(path)
: OpenWithEditor(path);
-
if (proc.IsError)
{
return proc.Error;
diff --git a/Peer.Domain/Commands/ConfigEditConfig.cs b/Peer/Commands/ConfigEditConfig.cs
similarity index 88%
rename from Peer.Domain/Commands/ConfigEditConfig.cs
rename to Peer/Commands/ConfigEditConfig.cs
index a98a8d1..d4f14a9 100644
--- a/Peer.Domain/Commands/ConfigEditConfig.cs
+++ b/Peer/Commands/ConfigEditConfig.cs
@@ -1,4 +1,4 @@
-namespace Peer.Domain.Commands;
+namespace Peer.Commands;
public class ConfigEditConfig
{
diff --git a/Peer.Domain/Commands/ConfigEditError.cs b/Peer/Commands/ConfigEditError.cs
similarity index 73%
rename from Peer.Domain/Commands/ConfigEditError.cs
rename to Peer/Commands/ConfigEditError.cs
index 456dd48..23fa1ef 100644
--- a/Peer.Domain/Commands/ConfigEditError.cs
+++ b/Peer/Commands/ConfigEditError.cs
@@ -1,4 +1,4 @@
-namespace Peer.Domain.Commands;
+namespace Peer.Commands;
public enum ConfigEditError
{
diff --git a/Peer.Domain/Commands/Details.cs b/Peer/Commands/Details.cs
similarity index 54%
rename from Peer.Domain/Commands/Details.cs
rename to Peer/Commands/Details.cs
index 77e12b9..f2fc64a 100644
--- a/Peer.Domain/Commands/Details.cs
+++ b/Peer/Commands/Details.cs
@@ -1,24 +1,18 @@
using System.Threading;
using System.Threading.Tasks;
+using Peer.Domain;
using wimm.Secundatives;
-namespace Peer.Domain.Commands
+namespace Peer.Commands
{
- public class Details
+ public class Details(
+ IPullRequestService prService,
+ IDetailsFormatter formatter,
+ IConsoleWriter consoleWriter)
{
- private readonly IPullRequestService _prService;
- private readonly IDetailsFormatter _formatter;
- private readonly IConsoleWriter _consoleWriter;
-
- public Details(
- IPullRequestService prService,
- IDetailsFormatter formatter,
- IConsoleWriter consoleWriter)
- {
- _prService = prService;
- _formatter = formatter;
- _consoleWriter = consoleWriter;
- }
+ private readonly IPullRequestService _prService = prService;
+ private readonly IDetailsFormatter _formatter = formatter;
+ private readonly IConsoleWriter _consoleWriter = consoleWriter;
public async Task> DetailsAsync(DetailsArguments args, CancellationToken token = default)
{
diff --git a/Peer.Domain/Commands/DetailsArguments.cs b/Peer/Commands/DetailsArguments.cs
similarity index 81%
rename from Peer.Domain/Commands/DetailsArguments.cs
rename to Peer/Commands/DetailsArguments.cs
index 801fc27..547ef92 100644
--- a/Peer.Domain/Commands/DetailsArguments.cs
+++ b/Peer/Commands/DetailsArguments.cs
@@ -1,4 +1,6 @@
-namespace Peer.Domain.Commands
+using Peer.Domain;
+
+namespace Peer.Commands
{
public class DetailsArguments
{
diff --git a/Peer.Domain/Commands/DetailsFormatter.cs b/Peer/Commands/DetailsFormatter.cs
similarity index 97%
rename from Peer.Domain/Commands/DetailsFormatter.cs
rename to Peer/Commands/DetailsFormatter.cs
index a0d1eac..5f3d4e8 100644
--- a/Peer.Domain/Commands/DetailsFormatter.cs
+++ b/Peer/Commands/DetailsFormatter.cs
@@ -1,10 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Peer.Domain;
using Peer.Domain.Util;
using wimm.Secundatives.Extensions;
-namespace Peer.Domain.Commands
+namespace Peer.Commands
{
//TODO:CN -- Ansi term code support
public class DetailsFormatter : IDetailsFormatter
diff --git a/Peer.Domain/Commands/IDetailsFormatter.cs b/Peer/Commands/IDetailsFormatter.cs
similarity index 77%
rename from Peer.Domain/Commands/IDetailsFormatter.cs
rename to Peer/Commands/IDetailsFormatter.cs
index 1bf848d..d2a2135 100644
--- a/Peer.Domain/Commands/IDetailsFormatter.cs
+++ b/Peer/Commands/IDetailsFormatter.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
+using Peer.Domain;
-namespace Peer.Domain.Commands
+namespace Peer.Commands
{
public interface IDetailsFormatter
{
diff --git a/Peer.Domain/Commands/Open.cs b/Peer/Commands/Open.cs
similarity index 80%
rename from Peer.Domain/Commands/Open.cs
rename to Peer/Commands/Open.cs
index b279e7f..45d895e 100644
--- a/Peer.Domain/Commands/Open.cs
+++ b/Peer/Commands/Open.cs
@@ -3,22 +3,16 @@
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
-using Peer.Domain.Exceptions;
+using Peer.Domain;
using Peer.Domain.Util;
using wimm.Secundatives;
-namespace Peer.Domain.Commands
+namespace Peer.Commands
{
- public class Open
+ public class Open(IPullRequestService prService, IOSInfoProvider infoProvider)
{
- private readonly IPullRequestService _prService;
- private readonly IOSInfoProvider _infoProvider;
-
- public Open(IPullRequestService prService, IOSInfoProvider infoProvider)
- {
- _prService = prService;
- _infoProvider = infoProvider;
- }
+ private readonly IPullRequestService _prService = prService;
+ private readonly IOSInfoProvider _infoProvider = infoProvider;
public async Task> OpenAsync(OpenArguments openOptions, CancellationToken token = default)
{
diff --git a/Peer.Domain/Commands/OpenArguments.cs b/Peer/Commands/OpenArguments.cs
similarity index 86%
rename from Peer.Domain/Commands/OpenArguments.cs
rename to Peer/Commands/OpenArguments.cs
index e8e0a15..2e3ecaf 100644
--- a/Peer.Domain/Commands/OpenArguments.cs
+++ b/Peer/Commands/OpenArguments.cs
@@ -1,6 +1,7 @@
using System;
+using Peer.Domain;
-namespace Peer.Domain.Commands
+namespace Peer.Commands
{
public class OpenArguments
{
diff --git a/Peer.Domain/Commands/Show.cs b/Peer/Commands/Show.cs
similarity index 69%
rename from Peer.Domain/Commands/Show.cs
rename to Peer/Commands/Show.cs
index 85a0fa3..3cf77ee 100644
--- a/Peer.Domain/Commands/Show.cs
+++ b/Peer/Commands/Show.cs
@@ -4,38 +4,29 @@
using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
-using Peer.Domain.Configuration.CommandConfigs;
+using Peer.Configuration.CommandConfigs;
+using Peer.Domain;
using Peer.Domain.Exceptions;
-using Peer.Domain.Filters;
+using Peer.Filters;
using wimm.Secundatives;
-namespace Peer.Domain.Commands
+namespace Peer.Commands
{
- public class Show
+ public class Show(
+ IPullRequestService prService,
+ IListFormatter formatter,
+ IConsoleWriter writer,
+ ShowConfig config,
+ ISorter? sorter = null,
+ IEnumerable? filters = null)
{
- private readonly IPullRequestService _pullRequestService;
- private readonly IListFormatter _formatter;
- private readonly IConsoleWriter _writer;
- private readonly ISorter? _sorter;
- private readonly List _filters;
+ private readonly IPullRequestService _pullRequestService = prService;
+ private readonly IListFormatter _formatter = formatter;
+ private readonly IConsoleWriter _writer = writer;
+ private readonly ISorter? _sorter = sorter;
+ private readonly List _filters = filters?.ToList() ?? new();
- public ShowConfig Config { get; }
-
- public Show(
- IPullRequestService prService,
- IListFormatter formatter,
- IConsoleWriter writer,
- ShowConfig config,
- ISorter? sorter = null,
- IEnumerable? filters = null)
- {
- _pullRequestService = prService;
- _formatter = formatter;
- _writer = writer;
- Config = config;
- _sorter = sorter;
- _filters = filters?.ToList() ?? new();
- }
+ public ShowConfig Config { get; } = config;
public async Task> ShowAsync(ShowArguments args, CancellationToken token = default)
{
diff --git a/Peer/Commands/ShowArguments.cs b/Peer/Commands/ShowArguments.cs
new file mode 100644
index 0000000..7767316
--- /dev/null
+++ b/Peer/Commands/ShowArguments.cs
@@ -0,0 +1,7 @@
+namespace Peer.Commands
+{
+ public class ShowArguments(int count)
+ {
+ public int Count { get; } = count;
+ }
+}
diff --git a/Peer.Domain/Commands/WatchShow.cs b/Peer/Commands/WatchShow.cs
similarity index 98%
rename from Peer.Domain/Commands/WatchShow.cs
rename to Peer/Commands/WatchShow.cs
index 8ed59e7..c37c5b2 100644
--- a/Peer.Domain/Commands/WatchShow.cs
+++ b/Peer/Commands/WatchShow.cs
@@ -4,7 +4,7 @@
using System.Threading.Tasks;
using wimm.Secundatives;
-namespace Peer.Domain.Commands
+namespace Peer.Commands
{
public class WatchShow
{
diff --git a/Peer/ConfigSections/ShowConfigSection.cs b/Peer/ConfigSections/ShowConfigSection.cs
index 54dcbb0..2cdabf8 100644
--- a/Peer/ConfigSections/ShowConfigSection.cs
+++ b/Peer/ConfigSections/ShowConfigSection.cs
@@ -1,4 +1,4 @@
-using Peer.Domain.Configuration.CommandConfigs;
+using Peer.Configuration.CommandConfigs;
namespace Peer.ConfigSections
{
diff --git a/Peer.Domain/Configuration/CommandConfigs/ShowConfig.cs b/Peer/Configuration/CommandConfigs/ShowConfig.cs
similarity index 94%
rename from Peer.Domain/Configuration/CommandConfigs/ShowConfig.cs
rename to Peer/Configuration/CommandConfigs/ShowConfig.cs
index 74f573a..4189f96 100644
--- a/Peer.Domain/Configuration/CommandConfigs/ShowConfig.cs
+++ b/Peer/Configuration/CommandConfigs/ShowConfig.cs
@@ -1,6 +1,6 @@
using System;
-namespace Peer.Domain.Configuration.CommandConfigs
+namespace Peer.Configuration.CommandConfigs
{
public class ShowConfig
{
diff --git a/Peer.Domain/Configuration/ConfigError.cs b/Peer/Configuration/ConfigError.cs
similarity index 79%
rename from Peer.Domain/Configuration/ConfigError.cs
rename to Peer/Configuration/ConfigError.cs
index 4eba0c3..6cb8fe6 100644
--- a/Peer.Domain/Configuration/ConfigError.cs
+++ b/Peer/Configuration/ConfigError.cs
@@ -1,4 +1,4 @@
-namespace Peer.Domain.Configuration
+namespace Peer.Configuration
{
public enum ConfigError
{
diff --git a/Peer.Domain/Configuration/ConfigurationService.cs b/Peer/Configuration/ConfigurationService.cs
similarity index 96%
rename from Peer.Domain/Configuration/ConfigurationService.cs
rename to Peer/Configuration/ConfigurationService.cs
index 57c49ff..04d02b5 100644
--- a/Peer.Domain/Configuration/ConfigurationService.cs
+++ b/Peer/Configuration/ConfigurationService.cs
@@ -3,11 +3,12 @@
using System.Linq;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
+using Peer.Domain.Configuration;
using Peer.Domain.Exceptions;
using Peer.Domain.Util;
using wimm.Secundatives;
-namespace Peer.Domain.Configuration
+namespace Peer.Configuration
{
public class ConfigurationService : IConfigurationService
{
diff --git a/Peer.Domain/Configuration/IConfigurationService.cs b/Peer/Configuration/IConfigurationService.cs
similarity index 58%
rename from Peer.Domain/Configuration/IConfigurationService.cs
rename to Peer/Configuration/IConfigurationService.cs
index 899bd04..66e06e7 100644
--- a/Peer.Domain/Configuration/IConfigurationService.cs
+++ b/Peer/Configuration/IConfigurationService.cs
@@ -1,8 +1,7 @@
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.DependencyInjection;
using wimm.Secundatives;
-namespace Peer.Domain.Configuration
+namespace Peer.Configuration
{
public interface IConfigurationService
{
diff --git a/Peer/ConsoleWriter.cs b/Peer/ConsoleWriter.cs
index 619aa15..c6c2cec 100644
--- a/Peer/ConsoleWriter.cs
+++ b/Peer/ConsoleWriter.cs
@@ -4,7 +4,6 @@
using System.Linq;
using System.Text;
using System.Threading;
-using Peer.Domain;
namespace Peer
{
diff --git a/Peer.Domain/DefaultEmojiProvider.cs b/Peer/DefaultEmojiProvider.cs
similarity index 97%
rename from Peer.Domain/DefaultEmojiProvider.cs
rename to Peer/DefaultEmojiProvider.cs
index 52255d7..5065d54 100644
--- a/Peer.Domain/DefaultEmojiProvider.cs
+++ b/Peer/DefaultEmojiProvider.cs
@@ -1,8 +1,9 @@
-using Peer.Domain.Exceptions;
+using Peer.Domain;
+using Peer.Domain.Exceptions;
using Peer.Domain.Util;
using wimm.Secundatives;
-namespace Peer.Domain
+namespace Peer
{
public class DefaultEmojiProvider : ISymbolProvider, ICheckSymbolProvider
{
diff --git a/Peer.Domain/Filters/ActionFilter.cs b/Peer/Filters/ActionFilter.cs
similarity index 92%
rename from Peer.Domain/Filters/ActionFilter.cs
rename to Peer/Filters/ActionFilter.cs
index 7c5327d..b298e1c 100644
--- a/Peer.Domain/Filters/ActionFilter.cs
+++ b/Peer/Filters/ActionFilter.cs
@@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Peer.Domain;
-namespace Peer.Domain.Filters
+namespace Peer.Filters
{
public class ActionFilter : IFilter
{
diff --git a/Peer.Domain/Filters/EnumMatchingFilter.cs b/Peer/Filters/EnumMatchingFilter.cs
similarity index 95%
rename from Peer.Domain/Filters/EnumMatchingFilter.cs
rename to Peer/Filters/EnumMatchingFilter.cs
index 2a84fd9..ec4baac 100644
--- a/Peer.Domain/Filters/EnumMatchingFilter.cs
+++ b/Peer/Filters/EnumMatchingFilter.cs
@@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Peer.Domain;
-namespace Peer.Domain.Filters
+namespace Peer.Filters
{
public class EnumMatchingFilter : IFilter
where T : struct, IComparable
diff --git a/Peer.Domain/Filters/IFilter.cs b/Peer/Filters/IFilter.cs
similarity index 80%
rename from Peer.Domain/Filters/IFilter.cs
rename to Peer/Filters/IFilter.cs
index 1af6200..42421f0 100644
--- a/Peer.Domain/Filters/IFilter.cs
+++ b/Peer/Filters/IFilter.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
+using Peer.Domain;
-namespace Peer.Domain.Filters
+namespace Peer.Filters
{
public interface IFilter
{
diff --git a/Peer.Domain/Filters/IPropertySelector.cs b/Peer/Filters/IPropertySelector.cs
similarity index 79%
rename from Peer.Domain/Filters/IPropertySelector.cs
rename to Peer/Filters/IPropertySelector.cs
index 73946af..f31bee7 100644
--- a/Peer.Domain/Filters/IPropertySelector.cs
+++ b/Peer/Filters/IPropertySelector.cs
@@ -1,6 +1,7 @@
using System;
+using Peer.Domain;
-namespace Peer.Domain.Filters
+namespace Peer.Filters
{
public interface IPropertySelector
{
diff --git a/Peer.Domain/Filters/PropertySelector.cs b/Peer/Filters/PropertySelector.cs
similarity index 91%
rename from Peer.Domain/Filters/PropertySelector.cs
rename to Peer/Filters/PropertySelector.cs
index 3be9ab9..4f69433 100644
--- a/Peer.Domain/Filters/PropertySelector.cs
+++ b/Peer/Filters/PropertySelector.cs
@@ -1,6 +1,7 @@
using System;
+using Peer.Domain;
-namespace Peer.Domain.Filters
+namespace Peer.Filters
{
public class PropertySelector : IPropertySelector
where T : IComparable
diff --git a/Peer.Domain/Filters/RegexFilter.cs b/Peer/Filters/RegexFilter.cs
similarity index 94%
rename from Peer.Domain/Filters/RegexFilter.cs
rename to Peer/Filters/RegexFilter.cs
index 0b6cfad..82cadf7 100644
--- a/Peer.Domain/Filters/RegexFilter.cs
+++ b/Peer/Filters/RegexFilter.cs
@@ -1,8 +1,9 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
+using Peer.Domain;
-namespace Peer.Domain.Filters
+namespace Peer.Filters
{
public class RegexFilter : IFilter
{
diff --git a/Peer.Domain/Formatters/CompactFormatter.cs b/Peer/Formatters/CompactFormatter.cs
similarity index 97%
rename from Peer.Domain/Formatters/CompactFormatter.cs
rename to Peer/Formatters/CompactFormatter.cs
index 106f01d..2e5a9df 100644
--- a/Peer.Domain/Formatters/CompactFormatter.cs
+++ b/Peer/Formatters/CompactFormatter.cs
@@ -1,7 +1,8 @@
using System.Collections.Generic;
+using Peer.Domain;
using Peer.Domain.Util;
-namespace Peer.Domain.Formatters
+namespace Peer.Formatters
{
//q(cn): Is there just an object that represents the parts of the format?
// if we're talking format it's include/exclude different properties and max
diff --git a/Peer/Handlers/ConfigEditHandler.cs b/Peer/Handlers/ConfigEditHandler.cs
index d36cea5..df43fc8 100644
--- a/Peer/Handlers/ConfigEditHandler.cs
+++ b/Peer/Handlers/ConfigEditHandler.cs
@@ -3,8 +3,7 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Peer.Apps;
-using Peer.ConfigSections;
-using Peer.Domain.Commands;
+using Peer.Commands;
using Peer.Parsing;
using Peer.Verbs;
using wimm.Secundatives;
diff --git a/Peer/Handlers/ConfigInitHandler.cs b/Peer/Handlers/ConfigInitHandler.cs
index 98e9d31..6132a8c 100644
--- a/Peer/Handlers/ConfigInitHandler.cs
+++ b/Peer/Handlers/ConfigInitHandler.cs
@@ -4,7 +4,6 @@
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Peer.Apps;
-using Peer.ConfigSections;
using Peer.Parsing;
using Peer.Verbs;
diff --git a/Peer/Handlers/ConfigShowHandler.cs b/Peer/Handlers/ConfigShowHandler.cs
index 6fc2994..d7e914f 100644
--- a/Peer/Handlers/ConfigShowHandler.cs
+++ b/Peer/Handlers/ConfigShowHandler.cs
@@ -4,7 +4,6 @@
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Peer.Apps;
-using Peer.ConfigSections;
using Peer.Parsing;
using Peer.Verbs;
diff --git a/Peer.Domain/IConsoleWriter.cs b/Peer/IConsoleWriter.cs
similarity index 90%
rename from Peer.Domain/IConsoleWriter.cs
rename to Peer/IConsoleWriter.cs
index 03d681a..b94fda3 100644
--- a/Peer.Domain/IConsoleWriter.cs
+++ b/Peer/IConsoleWriter.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Threading;
-namespace Peer.Domain
+namespace Peer
{
public interface IConsoleWriter
{
diff --git a/Peer.Domain/IListFormatter.cs b/Peer/IListFormatter.cs
similarity index 83%
rename from Peer.Domain/IListFormatter.cs
rename to Peer/IListFormatter.cs
index 5898dc6..a1fce1a 100644
--- a/Peer.Domain/IListFormatter.cs
+++ b/Peer/IListFormatter.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
+using Peer.Domain;
-namespace Peer.Domain
+namespace Peer
{
public interface IListFormatter
{
diff --git a/Peer.Domain/ISymbolProvider.cs b/Peer/ISymbolProvider.cs
similarity index 80%
rename from Peer.Domain/ISymbolProvider.cs
rename to Peer/ISymbolProvider.cs
index 04fc17f..ce4c8d0 100644
--- a/Peer.Domain/ISymbolProvider.cs
+++ b/Peer/ISymbolProvider.cs
@@ -1,6 +1,7 @@
-using wimm.Secundatives;
+using Peer.Domain;
+using wimm.Secundatives;
-namespace Peer.Domain
+namespace Peer
{
public interface ISymbolProvider
{
diff --git a/Peer/Parsing/FilterParser.cs b/Peer/Parsing/FilterParser.cs
index 6cd24fa..778940e 100644
--- a/Peer/Parsing/FilterParser.cs
+++ b/Peer/Parsing/FilterParser.cs
@@ -2,7 +2,7 @@
using System.Text.RegularExpressions;
using Peer.Domain;
using Peer.Domain.Exceptions;
-using Peer.Domain.Filters;
+using Peer.Filters;
using wimm.Secundatives;
using wimm.Secundatives.Extensions;
diff --git a/Peer/Parsing/PeerOptions.cs b/Peer/Parsing/PeerOptions.cs
index 3327a50..8cc2c68 100644
--- a/Peer/Parsing/PeerOptions.cs
+++ b/Peer/Parsing/PeerOptions.cs
@@ -1,13 +1,16 @@
-using Peer.ConfigSections;
+using System.Diagnostics.CodeAnalysis;
+using Peer.ConfigSections;
namespace Peer.Parsing
{
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
public class PeerOptions
{
public int? ShowTimeoutSeconds { get; set; }
public int? WatchIntervalSeconds { get; set; }
}
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
public class PeerEnvironmentOptions
{
public string ConfigPath { get; set; } = Constants.DefaultConfigPath;
diff --git a/Peer/Parsing/SelectorMap.cs b/Peer/Parsing/SelectorMap.cs
index 776a18a..0bdd07c 100644
--- a/Peer/Parsing/SelectorMap.cs
+++ b/Peer/Parsing/SelectorMap.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using Peer.Domain;
-using Peer.Domain.Filters;
+using Peer.Filters;
using wimm.Secundatives;
using wimm.Secundatives.Extensions;
diff --git a/Peer/Peer.csproj b/Peer/Peer.csproj
index e2e615f..510d822 100644
--- a/Peer/Peer.csproj
+++ b/Peer/Peer.csproj
@@ -1,7 +1,7 @@
Exe
- net6.0
+ net8.0
enable
disable
True
@@ -9,6 +9,14 @@
$(MSBuildProjectName.ToLower())
True
Debug;Release;Tool
+ preview
+
+
+
+ true
+ true
+ preview
+ InterceptorsPreview
@@ -36,15 +44,16 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/Peer/Program.cs b/Peer/Program.cs
index 5a99b06..0b448ec 100644
--- a/Peer/Program.cs
+++ b/Peer/Program.cs
@@ -2,19 +2,19 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
-using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Peer.Apps.AppBuilder;
+using Peer.Commands;
using Peer.ConfigSections;
+using Peer.Configuration;
using Peer.Domain;
-using Peer.Domain.Commands;
using Peer.Domain.Configuration;
-using Peer.Domain.Formatters;
using Peer.Domain.Util;
+using Peer.Formatters;
using Peer.GitHub;
using Peer.Handlers;
using Peer.Parsing;
@@ -247,7 +247,7 @@ private static Result SetupParseTimeServices(IS
services.AddSingleton(
sp => sp.GetRequiredService()
.GetSection("Peer:Environment")
- .Get());
+ .Get()!);
return new Result(services);
}
diff --git a/Peer/ProviderLoader.cs b/Peer/ProviderLoader.cs
index 4c864a0..48193f0 100644
--- a/Peer/ProviderLoader.cs
+++ b/Peer/ProviderLoader.cs
@@ -3,19 +3,15 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Peer.Apps.AppBuilder;
+using Peer.Configuration;
using Peer.Domain.Configuration;
using wimm.Secundatives;
namespace Peer;
-public class ProviderLoader : IRunTimeConfigHandler
+public class ProviderLoader(IEnumerable registrationHandlers) : IRunTimeConfigHandler
{
- private readonly List _registrationHandlers;
-
- public ProviderLoader(IEnumerable registrationHandlers)
- {
- _registrationHandlers = registrationHandlers.ToList();
- }
+ private readonly List _registrationHandlers = registrationHandlers.ToList();
public Result ConfigureServices(IServiceCollection services, IConfiguration config)
{
diff --git a/Server/Peer.Grpc/Peer.Grpc.csproj b/Server/Peer.Grpc/Peer.Grpc.csproj
new file mode 100644
index 0000000..59fdc80
--- /dev/null
+++ b/Server/Peer.Grpc/Peer.Grpc.csproj
@@ -0,0 +1,30 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Server/Peer.Grpc/Peerless/IdentifierModel.cs b/Server/Peer.Grpc/Peerless/IdentifierModel.cs
new file mode 100644
index 0000000..c43ac03
--- /dev/null
+++ b/Server/Peer.Grpc/Peerless/IdentifierModel.cs
@@ -0,0 +1,15 @@
+using Peer.Domain;
+
+namespace Peerless;
+
+public partial class IdentifierModel
+{
+ public IdentifierModel(Identifier identifier)
+ {
+ Id = identifier.Id;
+ Repo = identifier.Repo;
+ Owner = identifier.Owner;
+ Provider = identifier.Provider;
+ Author = identifier.Author;
+ }
+}
diff --git a/Server/Peer.Grpc/Peerless/PullRequestModel.cs b/Server/Peer.Grpc/Peerless/PullRequestModel.cs
new file mode 100644
index 0000000..a00703a
--- /dev/null
+++ b/Server/Peer.Grpc/Peerless/PullRequestModel.cs
@@ -0,0 +1,13 @@
+using Peer.Domain;
+
+namespace Peerless;
+
+public partial class PullRequestModel
+{
+ public PullRequestModel(PullRequest pr)
+ {
+ Id = pr.Id;
+ Url = pr.Url.ToString();
+ Identifier = new IdentifierModel(pr.Identifier);
+ }
+}
diff --git a/Server/Peer.Grpc/Protos/getPullRequest.proto b/Server/Peer.Grpc/Protos/getPullRequest.proto
new file mode 100644
index 0000000..87e48d6
--- /dev/null
+++ b/Server/Peer.Grpc/Protos/getPullRequest.proto
@@ -0,0 +1,65 @@
+syntax = "proto3";
+
+option csharp_namespace = "Peerless";
+// package peerless;
+
+service PullRequestGrpcService {
+ rpc GetPullRequest(GetPullRequestRequest) returns (GetPullRequestResponse);
+ rpc ListPullRequests(ListPullRequestsRequest) returns(ListPullRequestsResponse);
+}
+
+
+message PullRequestModel {
+ string id = 1;
+ string url = 2;
+ IdentifierModel identifier = 3;
+}
+
+message IdentifierModel {
+ string id = 1;
+ string repo = 2;
+ string owner = 3;
+ string provider = 4;
+ string author = 5;
+}
+
+message DescriptorModel {
+ string title = 1;
+ string description = 2;
+}
+
+enum PRStatus {
+ unknown = 0;
+ draft = 1;
+ conflict = 2;
+ failed_checks = 3;
+ actions_queued = 4;
+ actions_pending = 5;
+ awaiting_review = 6;
+ fixes_requested = 7;
+ ready_to_merge = 8;
+ merged = 9;
+ stale = 10;
+}
+
+message State {
+ PRStatus status = 1;
+ int32 total_comments = 2;
+ int32 active_comments =3;
+}
+
+message ListPullRequestsRequest {
+ string query = 1;
+}
+
+message ListPullRequestsResponse {
+ repeated PullRequestModel values = 1;
+}
+
+message GetPullRequestRequest{
+ int32 id = 1;
+}
+
+message GetPullRequestResponse {
+ PullRequestModel value = 1;
+}
\ No newline at end of file
diff --git a/Server/Peer.Server.Persistence/Peer.Server.Persistence.csproj b/Server/Peer.Server.Persistence/Peer.Server.Persistence.csproj
new file mode 100644
index 0000000..0308198
--- /dev/null
+++ b/Server/Peer.Server.Persistence/Peer.Server.Persistence.csproj
@@ -0,0 +1,21 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
diff --git a/Server/Peer.Server.Persistence/PeerContext.cs b/Server/Peer.Server.Persistence/PeerContext.cs
new file mode 100644
index 0000000..4ec28c4
--- /dev/null
+++ b/Server/Peer.Server.Persistence/PeerContext.cs
@@ -0,0 +1,28 @@
+using Microsoft.EntityFrameworkCore;
+
+namespace Peer.Server.Persistence
+{
+ public class PeerContext : DbContext
+ {
+ public PeerContext(DbContextOptions opts)
+ : base(opts)
+ {
+ }
+
+ public DbSet PullRequests { get; set; }
+ }
+
+ public class PullRequestModel
+ {
+ public string Id { get; }
+ public string? ExternalId { get; }
+ public string? RepoName { get; }
+ public string? Owner { get; }
+ public string? Provider { get; }
+ public string? Author { get; }
+
+ public Uri? Url { get; }
+ public string? Title { get; }
+ public string? Description { get; }
+ }
+}
diff --git a/Server/Peer.Server/Peer.Server.csproj b/Server/Peer.Server/Peer.Server.csproj
new file mode 100644
index 0000000..cef16b3
--- /dev/null
+++ b/Server/Peer.Server/Peer.Server.csproj
@@ -0,0 +1,26 @@
+
+
+ net8.0
+ enable
+ enable
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Server/Peer.Server/PeerSyncWorker.cs b/Server/Peer.Server/PeerSyncWorker.cs
new file mode 100644
index 0000000..b13a31e
--- /dev/null
+++ b/Server/Peer.Server/PeerSyncWorker.cs
@@ -0,0 +1,31 @@
+using Microsoft.Extensions.Hosting;
+
+namespace Peer.Server
+{
+ public enum SyncResult
+ {
+ // Formerly DaemonResult
+ Fire,
+ Brimstone,
+ Success
+ }
+
+ public class PeerSyncWorker : BackgroundService
+ {
+ // Ooh look at me I'm a spooky daemon, souls! bleh!
+
+ public PeerSyncWorker()
+ {
+
+ }
+
+ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
+ {
+ while (true)
+ {
+ //Console.WriteLine("OOh so spooky!");
+ await Task.Delay(TimeSpan.FromSeconds(2), stoppingToken);
+ }
+ }
+ }
+}
diff --git a/Server/Peer.Server/ServerBuilder.cs b/Server/Peer.Server/ServerBuilder.cs
new file mode 100644
index 0000000..3ee9eee
--- /dev/null
+++ b/Server/Peer.Server/ServerBuilder.cs
@@ -0,0 +1,54 @@
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Routing;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using Peer.Server.Persistence;
+using Peer.Server.Services;
+
+namespace Peer.Server
+{
+ public class ServerBuilder
+ {
+ //private const string _socketPath = "/var/run/peerless/peerless.sock";
+ public static WebApplication CreateHost(Action config)
+ {
+ var builder = WebApplication.CreateBuilder();
+ config.Invoke(builder);
+ builder.Services.AddLogging(c =>
+ {
+ c.ClearProviders();
+ c.AddConsole();
+ c.SetMinimumLevel(LogLevel.Trace);
+ });
+
+ builder.Services.AddHostedService();
+ builder.Services.AddGrpc();
+ RegisterPersistence(builder.Services);
+
+ var host = builder.Build();
+ host.MapGrpcService();
+ var src = host.Services.GetRequiredService();
+ return host;
+ }
+
+ public static IServiceCollection RegisterPersistence(IServiceCollection services)
+ {
+ services.AddDbContext(x => x.UseSqlite($"Data Source={SpecialPaths.StoragePath}"));
+ return services;
+ }
+ }
+
+ public class PeerServerConfig
+ {
+ public string? StoragePath { get; set; }
+ }
+
+ //Linux
+ public partial class SpecialPaths
+ {
+ public const string ConfigPath = "/etc/peer/peer.config";
+ public const string StoragePath = "/etc/peer/peer.sqlitedb";
+ }
+}
+
diff --git a/Server/Peer.Server/Services/PullRequestGrpc.cs b/Server/Peer.Server/Services/PullRequestGrpc.cs
new file mode 100644
index 0000000..6c91390
--- /dev/null
+++ b/Server/Peer.Server/Services/PullRequestGrpc.cs
@@ -0,0 +1,33 @@
+using Grpc.Core;
+using Microsoft.Extensions.Logging;
+using Peerless;
+
+namespace Peer.Server.Services;
+
+public class PullRequestGrpc : PullRequestGrpcService.PullRequestGrpcServiceBase
+{
+ private readonly ILogger _logger;
+
+ public PullRequestGrpc(ILogger logger)
+ {
+ _logger = logger;
+ }
+
+ public override Task GetPullRequest(GetPullRequestRequest request, ServerCallContext context)
+ {
+ return Task.FromResult(new GetPullRequestResponse()
+ {
+ Value = new PullRequestModel()
+ {
+ Id = 100.ToString(),
+ Identifier = new IdentifierModel { },
+ Url = "wakawka"
+ }
+ });
+ }
+
+ public override Task ListPullRequests(ListPullRequestsRequest request, ServerCallContext context)
+ {
+ return base.ListPullRequests(request, context);
+ }
+}
diff --git a/launchSettings.json b/launchSettings.json
new file mode 100644
index 0000000..670e98f
--- /dev/null
+++ b/launchSettings.json
@@ -0,0 +1,14 @@
+{
+ "profiles": {
+ "Docker Compose": {
+ "commandName": "DockerCompose",
+ "commandVersion": "1.0",
+ "composeLaunchAction": "None",
+ "composeLaunchServiceName": "peer.daemon.linux",
+ "serviceActions": {
+ "peer.daemon.linux": "StartDebugging",
+ "cli": "StartWithoutDebugging"
+ }
+ }
+ }
+}
\ No newline at end of file