Skip to content

Commit 2f4c844

Browse files
stho32claude
andcommitted
Update documentation for new features and add practical scenarios
Documentation updates: - Updated Server README with new endpoints and features - Updated Client README with task receiver mode - Updated Bot README with task commands - Added comprehensive logging and security sections New scenario guides: - Math calculation bots example - Distributed build system - Monitoring and alerting system - File synchronization and backup - Quick start guide for math bots - Scenarios overview page Updated main README with: - Links to new scenarios - Feature highlights (task system, logging, duplicate prevention) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent d6119f7 commit 2f4c844

File tree

10 files changed

+1342
-6
lines changed

10 files changed

+1342
-6
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,22 @@ Usage Scenarios include:
4242

4343
- [CI/CD-Pipeline](./docs/usage-cicd-pipeline.md)
4444
- [Central Log](./docs/usage-central-log.md)
45+
- [Math Calculation Bots](./docs/scenarios/math-calculation-bots.md)
46+
- [Distributed Build System](./docs/scenarios/distributed-build-system.md)
47+
- [Monitoring & Alerting](./docs/scenarios/monitoring-alerting-system.md)
48+
- [File Sync & Backup](./docs/scenarios/file-sync-backup.md)
49+
- [More Scenarios...](./docs/scenarios/README.md)
4550

4651
## Features
4752

4853
- Available for Windows, Linux and macOS
4954
- Easy to use
50-
- Adds a few simple entry points / command line tools that enable network communication between a group of hosts and sub applications.
55+
- Adds a few simple entry points / command line tools that enable network communication between a group of hosts and sub applications
56+
- **Task System**: Distribute work across multiple clients with tag-based routing
57+
- **Duplicate Prevention**: Messages with same ID are rejected within 1 hour
58+
- **Comprehensive Logging**: Daily rotating logs with Serilog integration
59+
- **Direct Messaging**: Send messages to specific clients using `/msg ClientName`
60+
- **File Storage**: Central file repository accessible by all clients
5161
- Ability to execute and run tasks between your local apps through command line over the network
5262
- Encrypted communication
5363
- and more

docs/Bot/README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,18 @@ The LNAC Bot only reacts to messages that are sent directly to it. It's main pur
99

1010
## Commands
1111

12-
- `exec filename parameter1 parameter2 parameter 3` will execute an existing script on the given path
13-
- `help filename` is a special command for powershell scripts only. It parses the Parameters that are defined at the top of the powershell script
14-
- `listcommands` will return a list of all existing scripts on the given path.
15-
- `/ping` well, just another ping pong command :)
12+
### Default Commands
13+
- `/ping` - Simple ping pong command to test bot connectivity
14+
15+
### Script Execution Commands (Private Messages Only)
16+
- `exec filename parameter1 parameter2 parameter 3` - Execute an existing script on the given path
17+
- `help filename` - Special command for PowerShell scripts only. Parses the parameters defined at the top of the script
18+
- `listcommands` - Returns a list of all existing scripts on the given path
19+
20+
### Task Commands
21+
- `/task "description" tags:tag1,tag2 params:{"key":"value"}` - Create a new task with optional tags and parameters
22+
- `/tasklist tags:tag1,tag2` - List pending tasks (optional tag filter)
23+
- `/taskstatus <task-id>` - Check the status of a specific task
1624

1725
## Bot CLI
1826

docs/Client/README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The LNAC Client allows you to communicate with the server as well as with other
44

55
## Features
66

7-
- 7 different modes which perform different tasks
7+
- 8 different modes which perform different tasks
88

99
### Client Modes
1010

@@ -37,6 +37,14 @@ The File operation mode allows the client to upload, download, delete and get a
3737
- filedelete // Will delete the given file from the server.
3838
- listfiles // Will return a list of all existing files on the server.
3939

40+
#### Task Receiver
41+
42+
The task receiver mode allows the client to process tasks from the server. The client polls for new tasks with matching tags, claims them, executes a configured processor script, and reports results back to the server.
43+
44+
```
45+
$ LocalNetAppChat.ConsoleClient taskreceiver --server "localhost" --port 51234 --key 1234 --tags "build,test" --processor "./run-task.ps1"
46+
```
47+
4048
## Client CLI
4149

4250
```console
@@ -51,6 +59,7 @@ LocalNetAppChat.ConsoleClient [options]
5159
filedelete Deletes an existing file from the server
5260
listfiles Returns a list of all existing files on the server
5361
chat Runs the client essentially in a listener mode, but when you start typing you are delivered a prompt and with enter you will send the message
62+
taskreceiver Run the client in task receiver mode to process tasks
5463
--file Path of the file you want to delete, download or upload from/to the server
5564
--targetPath Path where you want the requested File to be saved at after downloading it
5665
--text The text message to send to the server. (only when in message mode!)
@@ -60,6 +69,8 @@ LocalNetAppChat.ConsoleClient [options]
6069
--port The port the server should connect to (default: 5000)
6170
--https Whether to start the server as HTTPS or HTTP server
6271
--key An Authentication password that the server requires to allow incoming requests from the client!
72+
--tags Comma-separated list of tags for task filtering in task receiver mode
73+
--processor Path to the script/executable to process tasks in task receiver mode
6374

6475
Examples:
6576

@@ -77,5 +88,7 @@ LocalNetAppChat.ConsoleClient [options]
7788
$ LocalNetAppChat.ConsoleClient filedelete --server "localhost" --port 51234 --key 1234 --file "README.md"
7889
- List all files existing on the server
7990
$ LocalNetAppChat.ConsoleClient listfiles --server "localhost" --port 51234 --key 1234
91+
- Run the client in task receiver mode
92+
$ LocalNetAppChat.ConsoleClient taskreceiver --server "localhost" --port 51234 --key 1234 --tags "build,test" --processor "./run-task.ps1"
8093

8194
```

docs/Server/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ The LNAC Server is responsible for almost everything:
99
- Basic communication handling (Sending and Receiving messages to/from clients)
1010
- Basic Storage API (Can receive, upload and delete Files existing in the script folder on the folder)
1111
- Parsing and Handling `Direct Messages` between clients
12+
- Duplicate message prevention (1 hour retention)
13+
- Task management system for distributed work
14+
- Comprehensive logging with daily rotation (14-day retention)
1215

1316
## Server CLI
1417

@@ -32,3 +35,36 @@ LocalNetAppChat.Server [options]
3235
$ LocalNetAppChat.Server --listenOn "54.15.12.1" --port "54822" --https --key "HeythereGithubExample"
3336

3437
```
38+
39+
## Server API Endpoints
40+
41+
### Messaging
42+
- `GET /receive?key={key}&clientName={clientName}` - Poll for new messages
43+
- `POST /send?key={key}` - Send a message (body: LnacMessage JSON)
44+
45+
### File Storage
46+
- `POST /upload?key={key}` - Upload a file (multipart/form-data)
47+
- `GET /download?key={key}&filename={filename}` - Download a file
48+
- `GET /listallfiles?key={key}` - List all files
49+
- `POST /deletefile?key={key}&filename={filename}` - Delete a file
50+
51+
### Task Management
52+
- `POST /tasks/create?key={key}` - Create a new task (body: TaskMessage JSON)
53+
- `GET /tasks/pending?key={key}&tags={tags}` - Get pending tasks (optional tag filter)
54+
- `POST /tasks/claim?key={key}&taskId={id}&clientName={name}` - Claim a task
55+
- `POST /tasks/complete?key={key}&taskId={id}&clientName={name}&success={bool}&result={result}` - Complete a task
56+
- `GET /tasks/status?key={key}&taskId={id}` - Get task status
57+
58+
## Logging
59+
60+
The server uses Serilog for comprehensive logging:
61+
- Console output with timestamps
62+
- Daily rotating log files in `logs/` directory
63+
- 14-day retention policy
64+
- Log files named: `lnac-server-YYYYMMDD.log`
65+
66+
## Security
67+
68+
- Key-based authentication required for all endpoints
69+
- Messages are rejected if duplicate ID is detected within 1 hour
70+
- HTTPS support with `--https` flag

docs/quickstart-math-bots.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Schnellstart: Mathe-Bots in 5 Minuten
2+
3+
Eine schnelle Anleitung, um das Mathe-Bot-System zum Laufen zu bringen.
4+
5+
## Schritt 1: Scripts vorbereiten
6+
7+
Erstellen Sie einen Ordner `math-scripts` und fügen Sie diese Dateien hinzu:
8+
9+
### math-scripts/generate.ps1
10+
```powershell
11+
$a = Get-Random -Minimum 0 -Maximum 11
12+
$b = Get-Random -Minimum 0 -Maximum 11
13+
Write-Output "$a + $b = ?"
14+
```
15+
16+
### math-scripts/calculate.ps1
17+
```powershell
18+
param([string]$input)
19+
if ($input -match "(\d+)\s*\+\s*(\d+)") {
20+
$result = [int]$matches[1] + [int]$matches[2]
21+
Write-Output "Result: $result"
22+
if ($result -gt 10) {
23+
Write-Output "WOW! That's more than 10!"
24+
}
25+
}
26+
```
27+
28+
## Schritt 2: Alles starten
29+
30+
Öffnen Sie 4 Terminal-Fenster:
31+
32+
**Terminal 1 - Server:**
33+
```bash
34+
LocalNetAppChat.Server --port 5000 --key "demo"
35+
```
36+
37+
**Terminal 2 - Generator Bot:**
38+
```bash
39+
LocalNetAppChat.Bot --server localhost --port 5000 --key "demo" --clientName "GeneratorBot" --scriptspath "./math-scripts"
40+
```
41+
42+
**Terminal 3 - Calculator Bot:**
43+
```bash
44+
LocalNetAppChat.Bot --server localhost --port 5000 --key "demo" --clientName "CalculatorBot" --scriptspath "./math-scripts"
45+
```
46+
47+
**Terminal 4 - Observer:**
48+
```bash
49+
LocalNetAppChat.ConsoleClient listener --server localhost --port 5000 --key "demo" --clientName "Observer"
50+
```
51+
52+
## Schritt 3: Die Show starten
53+
54+
Öffnen Sie ein 5. Terminal für den Chat:
55+
```bash
56+
LocalNetAppChat.ConsoleClient chat --server localhost --port 5000 --key "demo" --clientName "Controller"
57+
```
58+
59+
Geben Sie im Chat ein:
60+
```
61+
/msg GeneratorBot exec generate.ps1
62+
```
63+
64+
## Was Sie sehen werden
65+
66+
Im Observer-Fenster erscheint:
67+
```
68+
[2024-01-20 15:30:45] GeneratorBot: 7 + 4 = ?
69+
```
70+
71+
Jetzt können Sie den Calculator triggern:
72+
```
73+
/msg CalculatorBot exec calculate.ps1 "7 + 4"
74+
```
75+
76+
Ausgabe:
77+
```
78+
[2024-01-20 15:30:50] CalculatorBot: Result: 11
79+
[2024-01-20 15:30:50] CalculatorBot: WOW! That's more than 10!
80+
```
81+
82+
## Automatisierung
83+
84+
Für kontinuierliche Generierung, erstellen Sie `auto-generate.ps1`:
85+
```powershell
86+
while($true) {
87+
$a = Get-Random -Minimum 0 -Maximum 11
88+
$b = Get-Random -Minimum 0 -Maximum 11
89+
Write-Output "/msg CalculatorBot exec calculate.ps1 `"$a + $b`""
90+
Start-Sleep -Seconds 3
91+
}
92+
```
93+
94+
Und starten Sie es:
95+
```
96+
/msg GeneratorBot exec auto-generate.ps1
97+
```
98+
99+
## Troubleshooting
100+
101+
**Problem:** "Access denied"
102+
- Lösung: Prüfen Sie, ob alle Komponenten denselben Key verwenden
103+
104+
**Problem:** Bot reagiert nicht
105+
- Lösung: Stellen Sie sicher, dass der Bot läuft und der Name korrekt ist
106+
107+
**Problem:** Scripts werden nicht gefunden
108+
- Lösung: Prüfen Sie den `--scriptspath` Parameter
109+
110+
## Nächste Schritte
111+
112+
- Fügen Sie mehr Mathematik-Operationen hinzu
113+
- Erstellen Sie einen Statistik-Bot
114+
- Implementieren Sie ein Punkte-System
115+
- Erweitern Sie auf Algebra-Aufgaben
116+
117+
Viel Spaß beim Experimentieren! 🎉

0 commit comments

Comments
 (0)