Refactor tools

This commit is contained in:
Dejvino
2026-06-30 19:40:58 +02:00
parent 64b6416929
commit e9a1187f34
7 changed files with 25 additions and 19 deletions
+2 -2
View File
@@ -28,9 +28,9 @@ the-chaos/
│ ├── engine.py # Game engine (prompt builder, LLM client, parser, state) │ ├── engine.py # Game engine (prompt builder, LLM client, parser, state)
│ ├── run.py # TUI (Textual app, game loop, narrative, input) │ ├── run.py # TUI (Textual app, game loop, narrative, input)
│ ├── ambience.py # CLI shortcut for ambience switching │ ├── ambience.py # CLI shortcut for ambience switching
│ ├── draw.py # Card drawing tool │ ├── draw_card.py # Card drawing tool
│ ├── music-fetch.py # YouTube audio downloader │ ├── music-fetch.py # YouTube audio downloader
│ ├── roll.py # Dice rolling tool │ ├── roll_dice.py # Dice rolling tool
│ ├── store_turn.py # DEPRECATED — use engine.py archive_turn instead │ ├── store_turn.py # DEPRECATED — use engine.py archive_turn instead
│ ├── test_imports.py # Import validation test │ ├── test_imports.py # Import validation test
│ └── test_runtime.py # Runtime import test │ └── test_runtime.py # Runtime import test
+7 -1
View File
@@ -1,7 +1,13 @@
#!/bin/bash #!/bin/bash
ERRORS=$(python3 -c "import os; [f for f in os.listdir('./tools') if f.endswith('.py') and os.path.getsize(os.path.join('./tools', f)) > 2048]") ERRORS=$(python3 -c "import os; [f for f in os.listdir('./tools') if f.endswith('.py') and os.path.getsize(os.path.join('./tools', f)) > 2048]")
if [ -z "$ERRORS" ]; then if [ -z "$ERRORS" ]; then
echo "OK" echo "Compiling tools/*.py..."
if python3 -m compileall tools/*.py; then
echo "OK"
else
echo "Compilation failed"
exit 1
fi
else else
echo "You need to refactor this:" echo "You need to refactor this:"
echo "$ERRORS" echo "$ERRORS"
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
paths.py — Path constants for The Chaos game engine. config_paths.py — Path constants for The Chaos game engine.
Shared by engine.py, run.py, and all sub-modules. Shared by engine.py, run.py, and all sub-modules.
""" """
+6 -6
View File
@@ -1,18 +1,18 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
draw.py — Draw a card from The Chaos deck. draw_card.py — Draw a card from The Chaos deck.
Usage: Usage:
python3 draw.py <deck> <table> [count] python3 draw_card.py <deck> <table> [count]
Decks: souls, cook, creatures, curiosities Decks: souls, cook, creatures, curiosities
Tables: see the YAML files (e.g. traits, rumours, type, drink_or_drug) Tables: see the YAML files (e.g. traits, rumours, type, drink_or_drug)
Examples: Examples:
python3 draw.py souls thing python3 draw_card.py souls thing
python3 draw.py cook rumours 3 python3 draw_card.py cook rumours 3
python3 draw.py creatures type appearance python3 draw_card.py creatures type appearance
python3 draw.py curiosities creepy_vibe python3 draw_card.py curiosities creepy_v<NEW_CHAR_HERE>_vibe
""" """
import sys import sys
+1 -1
View File
@@ -29,7 +29,7 @@ Wrap in ```tool to perform an action:
- **world_update** — content: "full world" (if NPCs/locations/threads change) - **world_update** — content: "full world" (if NPCs/locations/threads change)
- **journal_update** — add: [...], done: [...] - **journal_update** — add: [...], done: [...]
You have the full state above — no need to look anything up. Just write the story and use tools when the player's action changes something. You have the full state above — no need to look anything up. Just write the story and use tools when the player's action changes something. If a player action is impossible (e.g. they try to use an item they don't have), narrate the failure and DO NOT use any state-changing tools.
## State ## State
+7 -7
View File
@@ -1,9 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
roll.py — Roll dice for The Chaos TTRPG. roll_dice.py — Roll dice for The Chaos TTRPG.
Usage: Usage:
python3 roll.py <formula> [modifier] python3 roll_dice.py <formula> [modifier]
Formulas: Formulas:
1d6 Roll 1 six-sided die 1d6 Roll 1 six-sided die
@@ -18,11 +18,11 @@ Modifier: +/- number added to total
Examples: Examples:
python3 roll.py 1d6 python3 roll.py 1d6
python3 roll.py 3d6 python3 roll_dice.py 3d6
python3 roll.py 2d6x10 python3 roll_dice.py 2d6x10
python3 roll.py odds python3 roll_dice.py odds
python3 roll.py trait 9 python3 roll_dice.py trait 9
python3 roll.py 1d6 +1 python3 roll_dice.py 1d6 +1
""" """
import sys import sys
+1 -1
View File
@@ -7,7 +7,7 @@ import ast
MODULES = [ MODULES = [
'engine.py', 'engine.py',
'paths.py', 'config_paths.py',
'models.py', 'models.py',
'prompts.py', 'prompts.py',
'state.py', 'state.py',