add: terminal tool

This commit is contained in:
h z
2025-05-01 23:01:29 +01:00
parent eee9eca6cb
commit 11fed38dff
18 changed files with 98 additions and 21 deletions

13
.idea/.idea.Alchegos.Gitea.Webhook/.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/modules.xml
/contentModel.xml
/projectSettingsUpdater.xml
/.idea.Alchegos.Gitea.Webhook.iml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

13
.idea/.idea.Alchegos.Webhook/.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/projectSettingsUpdater.xml
/.idea.Alchegos.Webhook.iml
/contentModel.xml
/modules.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@@ -12,8 +12,8 @@
<Content Include="..\.dockerignore"> <Content Include="..\.dockerignore">
<Link>.dockerignore</Link> <Link>.dockerignore</Link>
</Content> </Content>
<PackageReference Include="Alchegos.Core" Version="0.0.1" />
<PackageReference Include="RabbitMQ.Client" Version="7.1.1" /> <PackageReference Include="RabbitMQ.Client" Version="7.1.1" />
<ProjectReference Include="..\Alchegos.Core\Alchegos.Core.csproj" />
</ItemGroup> </ItemGroup>

View File

@@ -1,4 +1,4 @@
namespace Alchegos.Gitea.Webhook; namespace Alchegos.Webhook;
public class AlchegosEventDispatcher public class AlchegosEventDispatcher
{ {

View File

@@ -7,17 +7,17 @@ EXPOSE 8080
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release ARG BUILD_CONFIGURATION=Release
WORKDIR /src WORKDIR /src
COPY ["Alchegos.Gitea.Webhook/Alchegos.Gitea.Webhook.csproj", "Alchegos.Gitea.Webhook/"] COPY ["Alchegos.Webhook.csproj", "./"]
RUN dotnet restore "Alchegos.Gitea.Webhook/Alchegos.Gitea.Webhook.csproj" RUN dotnet restore "Alchegos.Webhook.csproj"
COPY . . COPY . .
WORKDIR "/src/Alchegos.Gitea.Webhook" WORKDIR "/src/Alchegos.Webhook"
RUN dotnet build "Alchegos.Gitea.Webhook.csproj" -c $BUILD_CONFIGURATION -o /app/build RUN dotnet build "/src/Alchegos.Webhook.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish FROM build AS publish
ARG BUILD_CONFIGURATION=Release ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "Alchegos.Gitea.Webhook.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false RUN dotnet publish "Alchegos.Webhook.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final FROM base AS final
WORKDIR /app WORKDIR /app
COPY --from=publish /app/publish . COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Alchegos.Gitea.Webhook.dll"] ENTRYPOINT ["dotnet", "Alchegos.Webhook.dll"]

View File

@@ -1,8 +1,9 @@
using System.Text.Json.Nodes; using System.Text.Json.Nodes;
using Alchegos.Core.Services.RabbitMQ; using Alchegos.Core.Services.RabbitMQ;
using Alchegos.Gitea.Webhook.Handlers; using Alchegos.Webhook.Handlers;
using Alchegos.Webhook.Handlers.GiteaEventHandlers;
namespace Alchegos.Gitea.Webhook; namespace Alchegos.Webhook;
public class GiteaEventDispatcher public class GiteaEventDispatcher
{ {

View File

@@ -1,4 +1,4 @@
namespace Alchegos.Gitea.Webhook.Handlers; namespace Alchegos.Webhook.Handlers.AlchegosEventHandlers;
public interface IAlchegosEventHandler : IWebhookEventHandler public interface IAlchegosEventHandler : IWebhookEventHandler
{ {

View File

@@ -0,0 +1,12 @@
using System.Text.Json.Nodes;
using Alchegos.Core.Services.RabbitMQ;
namespace Alchegos.Webhook.Handlers.AlchegosEventHandlers;
public class ProjectPlanEventHandler : IAlchegosEventHandler
{
public Task HandleAsync(JsonNode payload, IRabbitPublisher publisher)
{
throw new NotImplementedException();
}
}

View File

@@ -1,4 +1,4 @@
namespace Alchegos.Gitea.Webhook.Handlers; namespace Alchegos.Webhook.Handlers.GiteaEventHandlers;
public interface IGiteaEventHandler: IWebhookEventHandler public interface IGiteaEventHandler: IWebhookEventHandler
{ {

View File

@@ -2,7 +2,7 @@ using System.Text.Json;
using System.Text.Json.Nodes; using System.Text.Json.Nodes;
using Alchegos.Core.Services.RabbitMQ; using Alchegos.Core.Services.RabbitMQ;
namespace Alchegos.Gitea.Webhook.Handlers; namespace Alchegos.Webhook.Handlers.GiteaEventHandlers;
public class IssueCommentEventHandler : IGiteaEventHandler public class IssueCommentEventHandler : IGiteaEventHandler
{ {
@@ -11,7 +11,7 @@ public class IssueCommentEventHandler : IGiteaEventHandler
if (payload["action"]?.ToString() != "created") if (payload["action"]?.ToString() != "created")
return; return;
var message = new Dictionary<string, string> Dictionary<string, string> message = new Dictionary<string, string>
{ {
{"repo_url", payload["repository"]?["url"]?.ToString()}, {"repo_url", payload["repository"]?["url"]?.ToString()},
{"repo_owner", payload["repository"]?["owner"]?["login"]?.ToString()}, {"repo_owner", payload["repository"]?["owner"]?["login"]?.ToString()},

View File

@@ -2,7 +2,7 @@ using System.Text.Json;
using System.Text.Json.Nodes; using System.Text.Json.Nodes;
using Alchegos.Core.Services.RabbitMQ; using Alchegos.Core.Services.RabbitMQ;
namespace Alchegos.Gitea.Webhook.Handlers; namespace Alchegos.Webhook.Handlers.GiteaEventHandlers;
public class IssuesEventHandler : IGiteaEventHandler public class IssuesEventHandler : IGiteaEventHandler
{ {

View File

@@ -2,7 +2,7 @@ using System.Text.Json;
using System.Text.Json.Nodes; using System.Text.Json.Nodes;
using Alchegos.Core.Services.RabbitMQ; using Alchegos.Core.Services.RabbitMQ;
namespace Alchegos.Gitea.Webhook.Handlers; namespace Alchegos.Webhook.Handlers.GiteaEventHandlers;
public class PullRequestEventHandler : IGiteaEventHandler public class PullRequestEventHandler : IGiteaEventHandler
{ {

View File

@@ -2,7 +2,7 @@ using System.Text.Json;
using System.Text.Json.Nodes; using System.Text.Json.Nodes;
using Alchegos.Core.Services.RabbitMQ; using Alchegos.Core.Services.RabbitMQ;
namespace Alchegos.Gitea.Webhook.Handlers; namespace Alchegos.Webhook.Handlers.GiteaEventHandlers;
public class PushEventHandler : IGiteaEventHandler public class PushEventHandler : IGiteaEventHandler
{ {

View File

@@ -1,7 +1,7 @@
using System.Text.Json.Nodes; using System.Text.Json.Nodes;
using Alchegos.Core.Services.RabbitMQ; using Alchegos.Core.Services.RabbitMQ;
namespace Alchegos.Gitea.Webhook.Handlers; namespace Alchegos.Webhook.Handlers;
public interface IWebhookEventHandler public interface IWebhookEventHandler
{ {

View File

@@ -1,8 +1,9 @@
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Nodes; using System.Text.Json.Nodes;
using Alchegos.Core.Services.RabbitMQ; using Alchegos.Core.Services.RabbitMQ;
using Alchegos.Webhook.Handlers.GiteaEventHandlers;
namespace Alchegos.Gitea.Webhook.Handlers; namespace Alchegos.Webhook.Handlers;
public class ProjectPlanEventHandler : IGiteaEventHandler public class ProjectPlanEventHandler : IGiteaEventHandler
{ {

View File

@@ -1,7 +1,7 @@
using System.Text.Json.Nodes; using System.Text.Json.Nodes;
using Alchegos.Core; using Alchegos.Core;
using Alchegos.Core.Services.RabbitMQ; using Alchegos.Core.Services.RabbitMQ;
using Alchegos.Gitea.Webhook; using Alchegos.Webhook;
GlobalRegistry.Instance.Start(); GlobalRegistry.Instance.Start();

View File

@@ -1,7 +1,7 @@
{ {
"$schema": "https://json.schemastore.org/launchsettings.json", "$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": { "profiles": {
"Alchegos.Gitea.Webhook": { "Alchegos.Webhook": {
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": true, "dotnetRunMessages": true,
"environmentVariables": { "environmentVariables": {

37
summerizer Executable file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/python3
import os
ignores = [
'bin',
'obj',
'.godot',
'.idea',
'icon.svg',
'icon.svg.import',
"Resources",
"GiteaApiClient.cs"
]
def find_all_proj_files(base_path):
res = []
for root, dirs, files in os.walk(base_path):
dirs[:] = [d for d in dirs if not d.startswith('.') and not d in ignores]
for file in files:
if file not in ignores:
res.append(os.path.join(root, file))
return res
def summerizer():
current_dir = os.path.dirname(os.path.abspath(__file__))
fs = find_all_proj_files(current_dir)
res = ""
for file in fs:
with open(file) as f:
res += f"---------------------{file}-------------------------\n"
res += f.read()
res += "\n"
print(res)
summerizer()