This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
LocalNetAppChat (LNAC) is a unified CLI tool for local network communication written in C#/.NET 10.0. A single lnac binary provides:
- Server mode: ASP.NET Core Web API handling message routing, file storage, and task management
- Client modes: Send/receive messages, file operations, task processing, emitter
- Bot mode: Plugin-based command execution (PowerShell/Python scripts)
cd Source/LocalNetAppChat
dotnet build
# Or use the build script
./build.ps1 buildcd Source/LocalNetAppChat
dotnet testcd Source/LocalNetAppChat/LocalNetAppChat.Cli
# Server mode
dotnet run -- server --key "MySecretKey"
# Client modes
dotnet run -- message --server localhost --key "MySecretKey" --text "Hello"
dotnet run -- listener --server localhost --key "MySecretKey"
dotnet run -- chat --server localhost --key "MySecretKey"
# Bot mode
dotnet run -- bot --server localhost --key "MySecretKey" --scriptspath ./scriptsSource/LocalNetAppChat/
├── CommandLineArguments/ # Shared CLI parsing utilities
├── LocalNetAppChat.Cli/ # Unified CLI application (server + client + bot)
│ └── Plugins/ # Bot plugin implementations (Ping, Execute, Tasks)
├── LocalNetAppChat.Domain/ # Shared domain logic and models
├── LocalNetAppChat.Server.Domain/ # Server-specific domain logic
├── LocalNetAppChat.Domain.Tests/
├── LocalNetAppChat.Server.Domain.Tests/
└── LocalNetAppChat.Bot.Tests/
-
Unified CLI with Subcommands
- Single entry point (
lnac) routes to server, client, or bot mode - Server mode starts ASP.NET Core with Minimal API endpoints
- Client modes use the OperatingMode strategy pattern
- Bot mode runs a polling loop with plugin-based command execution
- Single entry point (
-
Message Processing Pipeline
- Server uses a pipeline pattern for processing incoming messages
- Pipeline: AddId → AddTimestamp → ExtractReceiver
- Located in
LocalNetAppChat.Server.Domain/Messaging/MessageProcessing/
-
Plugin Architecture (Bot mode)
- Bot plugins implement
IClientCommandinterface - Plugins respond to specific commands (e.g.,
/ping,exec) - Plugin implementations in
LocalNetAppChat.Cli/Plugins/
- Bot plugins implement
-
Client Operating Modes
listener: Receive messages onlymessage: Send single messagechat: Interactive send/receivebot: Automated command execution with pluginsemitter: Stream command output to servertaskreceiver: Process distributed tasksfileupload/download/delete/listfiles: File operations
-
Security
- API key authentication via
X-API-Keyheader (or query parameter for backward compat) - Constant-time key comparison (CryptographicOperations.FixedTimeEquals)
- Rate limiting: 100 req/min per IP
- Security headers: X-Content-Type-Options, X-Frame-Options
- HTTPS support via
--httpsflag
- API key authentication via
-
Adding New Bot Commands: Create plugin in
LocalNetAppChat.Cli/Plugins/implementingIClientCommand -
Modifying Message Processing: Update pipeline in
LocalNetAppChat.Server.Domain/Messaging/MessageProcessing/ -
Adding Client Modes: Create new
IOperatingModeinLocalNetAppChat.Domain/Clientside/OperatingModes/ -
Testing: Add unit tests in corresponding
.Testsprojects maintaining existing NUnit patterns