codex/add-tgbot-project #1

Merged
mikhail merged 2 commits from codex/add-tgbot-project into main 2026-04-19 12:40:16 +03:00
11 changed files with 125 additions and 3 deletions
+2
View File
@@ -3,3 +3,5 @@ obj/
/packages/ /packages/
riderModule.iml riderModule.iml
/_ReSharper.Caches/ /_ReSharper.Caches/
.idea/.idea.GymLogAI/.idea/indexLayout.xml
.idea/.idea.GymLogAI/.idea/vcs.xml
+50
View File
@@ -0,0 +1,50 @@
# AGENTS.md
Shared rules for all AI agents working in this repository.
## Tech Stack
- **.NET 10.0** — ASP.NET Core minimal APIs
- **C#** — primary language
- **Docker / Docker Compose** — containerization
## Commands
```bash
# Build
dotnet build
# Run (development)
dotnet run --project GymLogAI.API/
# Run with HTTPS profile
dotnet run --project GymLogAI.API/ --launch-profile https
# Docker Compose
docker compose -f compose.yaml up --build
```
No test project exists yet. When one is added, the command will be `dotnet test`.
## Project Structure
```
GymLogAI.sln
GymLogAI.API/
Program.cs # entry point, minimal API endpoint registration
appsettings*.json # environment-specific config
Dockerfile # multi-stage build (SDK 10 → Runtime 10)
compose.yaml # Docker Compose orchestration
```
## Architecture
- Minimal API pattern — endpoints registered directly in `Program.cs`
- Ports: HTTP 5202 (local), HTTPS 7225 (local); 8080/8081 inside Docker
- OpenAPI enabled via `Microsoft.AspNetCore.OpenApi`
## Conventions
- Keep endpoints in `Program.cs` until the project grows enough to warrant endpoint groups or controllers
- Use records for DTOs
- Follow existing `appsettings.json` / `appsettings.Development.json` split for environment config
+11
View File
@@ -0,0 +1,11 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
> All shared rules (commands, architecture, conventions) live in [AGENTS.md](AGENTS.md) and apply here as well.
## Claude CodeSpecific Notes
- This is a greenfield project — the `WeatherForecast` endpoint in `Program.cs` is a template placeholder and can be replaced entirely.
- There is no database, auth, or domain layer yet; add these incrementally as features are defined.
- REST Client test file: `GymLogAI.API/GymLogAI.API.http` — keep it updated when endpoints change.
+5 -1
View File
@@ -8,7 +8,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.6"/> <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.6" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -17,4 +17,8 @@
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GymLogAI.TgBot\GymLogAI.TgBot.csproj" />
</ItemGroup>
</Project> </Project>
+3
View File
@@ -1,3 +1,5 @@
using GymLogAI.TgBot;
namespace GymLogAI.API; namespace GymLogAI.API;
public class Program public class Program
@@ -8,6 +10,7 @@ public class Program
// Add services to the container. // Add services to the container.
builder.Services.AddAuthorization(); builder.Services.AddAuthorization();
builder.Services.AddTgBot(builder.Configuration);
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi // Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi(); builder.Services.AddOpenApi();
@@ -4,5 +4,8 @@
"Default": "Information", "Default": "Information",
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
},
"TelegramBot": {
"BotToken": ""
} }
} }
+3
View File
@@ -5,5 +5,8 @@
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },
"TelegramBot": {
"BotToken": ""
},
"AllowedHosts": "*" "AllowedHosts": "*"
} }
+13
View File
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
</Project>
+8
View File
@@ -0,0 +1,8 @@
namespace GymLogAI.TgBot;
public sealed record TelegramBotOptions
{
public const string SectionName = "TelegramBot";
public string? BotToken { get; init; }
}
@@ -0,0 +1,19 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace GymLogAI.TgBot;
public static class TgBotServiceCollectionExtensions
{
public static IServiceCollection AddTgBot(this IServiceCollection services, IConfiguration configuration)
{
ArgumentNullException.ThrowIfNull(services);
ArgumentNullException.ThrowIfNull(configuration);
services
.AddOptions<TelegramBotOptions>()
.Bind(configuration.GetSection(TelegramBotOptions.SectionName));
return services;
}
}
+6
View File
@@ -7,6 +7,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
compose.yaml = compose.yaml compose.yaml = compose.yaml
EndProjectSection EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GymLogAI.TgBot", "GymLogAI.TgBot\GymLogAI.TgBot.csproj", "{BAF381C4-F522-4A59-B86D-3B9D3DA3D6AD}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -17,5 +19,9 @@ Global
{42540161-196B-43B8-998E-FA9BDD01A74C}.Debug|Any CPU.Build.0 = Debug|Any CPU {42540161-196B-43B8-998E-FA9BDD01A74C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42540161-196B-43B8-998E-FA9BDD01A74C}.Release|Any CPU.ActiveCfg = Release|Any CPU {42540161-196B-43B8-998E-FA9BDD01A74C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{42540161-196B-43B8-998E-FA9BDD01A74C}.Release|Any CPU.Build.0 = Release|Any CPU {42540161-196B-43B8-998E-FA9BDD01A74C}.Release|Any CPU.Build.0 = Release|Any CPU
{BAF381C4-F522-4A59-B86D-3B9D3DA3D6AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BAF381C4-F522-4A59-B86D-3B9D3DA3D6AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BAF381C4-F522-4A59-B86D-3B9D3DA3D6AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BAF381C4-F522-4A59-B86D-3B9D3DA3D6AD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal