codex-bot 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codex_bot-0.1.0/.claude/project.md +25 -0
- codex_bot-0.1.0/.claude/settings.local.json +10 -0
- codex_bot-0.1.0/.github/workflows/docs.yml +39 -0
- codex_bot-0.1.0/.gitignore +68 -0
- codex_bot-0.1.0/.pre-commit-config.yaml +38 -0
- codex_bot-0.1.0/CHANGELOG.md +29 -0
- codex_bot-0.1.0/CLAUDE.md +48 -0
- codex_bot-0.1.0/LICENSE +21 -0
- codex_bot-0.1.0/PKG-INFO +116 -0
- codex_bot-0.1.0/README.md +71 -0
- codex_bot-0.1.0/docs/DOCUMENTATION_STANDARD.md +142 -0
- codex_bot-0.1.0/docs/README.md +36 -0
- codex_bot-0.1.0/docs/api/README.md +3 -0
- codex_bot-0.1.0/docs/api/animation.md +9 -0
- codex_bot-0.1.0/docs/api/base.md +21 -0
- codex_bot-0.1.0/docs/api/cli.md +20 -0
- codex_bot-0.1.0/docs/api/director.md +13 -0
- codex_bot-0.1.0/docs/api/discovery.md +5 -0
- codex_bot-0.1.0/docs/api/factory.md +5 -0
- codex_bot-0.1.0/docs/api/fsm.md +22 -0
- codex_bot-0.1.0/docs/api/helper.md +5 -0
- codex_bot-0.1.0/docs/api/http.md +11 -0
- codex_bot-0.1.0/docs/api/middlewares.md +19 -0
- codex_bot-0.1.0/docs/api/redis.md +19 -0
- codex_bot-0.1.0/docs/api/router_builder.md +9 -0
- codex_bot-0.1.0/docs/api/sender.md +17 -0
- codex_bot-0.1.0/docs/api/url_signer.md +7 -0
- codex_bot-0.1.0/docs/en_EN/README.md +36 -0
- codex_bot-0.1.0/docs/en_EN/architecture/animation/README.md +39 -0
- codex_bot-0.1.0/docs/en_EN/architecture/base/README.md +38 -0
- codex_bot-0.1.0/docs/en_EN/architecture/cli/README.md +38 -0
- codex_bot-0.1.0/docs/en_EN/architecture/director/README.md +39 -0
- codex_bot-0.1.0/docs/en_EN/architecture/engine/README.md +41 -0
- codex_bot-0.1.0/docs/en_EN/architecture/fsm/README.md +38 -0
- codex_bot-0.1.0/docs/en_EN/architecture/helper/README.md +37 -0
- codex_bot-0.1.0/docs/en_EN/architecture/redis/README.md +40 -0
- codex_bot-0.1.0/docs/en_EN/architecture/sender/README.md +41 -0
- codex_bot-0.1.0/docs/en_EN/architecture/url_signer/README.md +38 -0
- codex_bot-0.1.0/docs/guide/getting_started.md +20 -0
- codex_bot-0.1.0/docs/ru_RU/README.md +36 -0
- codex_bot-0.1.0/docs/ru_RU/architecture/animation/README.md +39 -0
- codex_bot-0.1.0/docs/ru_RU/architecture/base/README.md +38 -0
- codex_bot-0.1.0/docs/ru_RU/architecture/cli/README.md +38 -0
- codex_bot-0.1.0/docs/ru_RU/architecture/director/README.md +39 -0
- codex_bot-0.1.0/docs/ru_RU/architecture/engine/README.md +41 -0
- codex_bot-0.1.0/docs/ru_RU/architecture/fsm/README.md +38 -0
- codex_bot-0.1.0/docs/ru_RU/architecture/helper/README.md +37 -0
- codex_bot-0.1.0/docs/ru_RU/architecture/redis/README.md +40 -0
- codex_bot-0.1.0/docs/ru_RU/architecture/sender/README.md +41 -0
- codex_bot-0.1.0/docs/ru_RU/architecture/url_signer/README.md +38 -0
- codex_bot-0.1.0/mkdocs.yml +67 -0
- codex_bot-0.1.0/project_structure.txt +207 -0
- codex_bot-0.1.0/pyproject.toml +85 -0
- codex_bot-0.1.0/src/codex_bot/__init__.py +24 -0
- codex_bot-0.1.0/src/codex_bot/animation/__init__.py +10 -0
- codex_bot-0.1.0/src/codex_bot/animation/animation_service.py +298 -0
- codex_bot-0.1.0/src/codex_bot/base/__init__.py +22 -0
- codex_bot-0.1.0/src/codex_bot/base/base_orchestrator.py +123 -0
- codex_bot-0.1.0/src/codex_bot/base/context_dto.py +42 -0
- codex_bot-0.1.0/src/codex_bot/base/view_dto.py +93 -0
- codex_bot-0.1.0/src/codex_bot/cli/__init__.py +11 -0
- codex_bot-0.1.0/src/codex_bot/cli/commands.py +215 -0
- codex_bot-0.1.0/src/codex_bot/director/__init__.py +13 -0
- codex_bot-0.1.0/src/codex_bot/director/director.py +107 -0
- codex_bot-0.1.0/src/codex_bot/director/protocols.py +80 -0
- codex_bot-0.1.0/src/codex_bot/engine/__init__.py +13 -0
- codex_bot-0.1.0/src/codex_bot/engine/discovery/__init__.py +7 -0
- codex_bot-0.1.0/src/codex_bot/engine/discovery/service.py +258 -0
- codex_bot-0.1.0/src/codex_bot/engine/factory/__init__.py +7 -0
- codex_bot-0.1.0/src/codex_bot/engine/factory/bot_builder.py +111 -0
- codex_bot-0.1.0/src/codex_bot/engine/http/__init__.py +10 -0
- codex_bot-0.1.0/src/codex_bot/engine/http/api_client.py +123 -0
- codex_bot-0.1.0/src/codex_bot/engine/i18n/__init__.py +7 -0
- codex_bot-0.1.0/src/codex_bot/engine/i18n/locales_compiler.py +83 -0
- codex_bot-0.1.0/src/codex_bot/engine/middlewares/__init__.py +24 -0
- codex_bot-0.1.0/src/codex_bot/engine/middlewares/container.py +46 -0
- codex_bot-0.1.0/src/codex_bot/engine/middlewares/i18n.py +90 -0
- codex_bot-0.1.0/src/codex_bot/engine/middlewares/throttling.py +69 -0
- codex_bot-0.1.0/src/codex_bot/engine/middlewares/user_validation.py +49 -0
- codex_bot-0.1.0/src/codex_bot/engine/router_builder/__init__.py +10 -0
- codex_bot-0.1.0/src/codex_bot/engine/router_builder/router_builder.py +133 -0
- codex_bot-0.1.0/src/codex_bot/fsm/__init__.py +16 -0
- codex_bot-0.1.0/src/codex_bot/fsm/common_fsm_handlers.py +46 -0
- codex_bot-0.1.0/src/codex_bot/fsm/garbage_collector.py +141 -0
- codex_bot-0.1.0/src/codex_bot/fsm/state_helper.py +72 -0
- codex_bot-0.1.0/src/codex_bot/fsm/state_manager.py +104 -0
- codex_bot-0.1.0/src/codex_bot/helper/__init__.py +7 -0
- codex_bot-0.1.0/src/codex_bot/helper/context_helper.py +61 -0
- codex_bot-0.1.0/src/codex_bot/redis/__init__.py +15 -0
- codex_bot-0.1.0/src/codex_bot/redis/dispatcher.py +169 -0
- codex_bot-0.1.0/src/codex_bot/redis/router.py +71 -0
- codex_bot-0.1.0/src/codex_bot/redis/stream_processor.py +210 -0
- codex_bot-0.1.0/src/codex_bot/sender/__init__.py +15 -0
- codex_bot-0.1.0/src/codex_bot/sender/protocols.py +67 -0
- codex_bot-0.1.0/src/codex_bot/sender/sender_keys.py +50 -0
- codex_bot-0.1.0/src/codex_bot/sender/sender_manager.py +85 -0
- codex_bot-0.1.0/src/codex_bot/sender/view_sender.py +200 -0
- codex_bot-0.1.0/src/codex_bot/templates/feature/callbacks.py.tpl +14 -0
- codex_bot-0.1.0/src/codex_bot/templates/feature/contract.py.tpl +12 -0
- codex_bot-0.1.0/src/codex_bot/templates/feature/dto.py.tpl +7 -0
- codex_bot-0.1.0/src/codex_bot/templates/feature/feature.py.tpl +26 -0
- codex_bot-0.1.0/src/codex_bot/templates/feature/feature_redis.py.tpl +6 -0
- codex_bot-0.1.0/src/codex_bot/templates/feature/formatters.py.tpl +15 -0
- codex_bot-0.1.0/src/codex_bot/templates/feature/handlers.py.tpl +32 -0
- codex_bot-0.1.0/src/codex_bot/templates/feature/handlers_redis.py.tpl +24 -0
- codex_bot-0.1.0/src/codex_bot/templates/feature/keyboards.py.tpl +14 -0
- codex_bot-0.1.0/src/codex_bot/templates/feature/orchestrator.py.tpl +26 -0
- codex_bot-0.1.0/src/codex_bot/templates/feature/orchestrator_redis.py.tpl +17 -0
- codex_bot-0.1.0/src/codex_bot/templates/feature/texts.py.tpl +6 -0
- codex_bot-0.1.0/src/codex_bot/templates/feature/ui.py.tpl +19 -0
- codex_bot-0.1.0/src/codex_bot/url_signer/__init__.py +7 -0
- codex_bot-0.1.0/src/codex_bot/url_signer/service.py +116 -0
- codex_bot-0.1.0/tests/animation/test_animation_service.py +55 -0
- codex_bot-0.1.0/tests/base/test_base_orchestrator.py +54 -0
- codex_bot-0.1.0/tests/base/test_view_dto.py +48 -0
- codex_bot-0.1.0/tests/conftest.py +42 -0
- codex_bot-0.1.0/tests/director/test_director.py +54 -0
- codex_bot-0.1.0/tests/engine/factory/test_bot_builder.py +37 -0
- codex_bot-0.1.0/tests/engine/http/test_api_client.py +60 -0
- codex_bot-0.1.0/tests/engine/middlewares/test_throttling.py +62 -0
- codex_bot-0.1.0/tests/fsm/test_garbage_collector.py +50 -0
- codex_bot-0.1.0/tests/fsm/test_state_manager.py +48 -0
- codex_bot-0.1.0/tests/helper/test_context_helper.py +47 -0
- codex_bot-0.1.0/tests/sender/test_sender_keys.py +16 -0
- codex_bot-0.1.0/tests/url_signer/test_url_signer.py +49 -0
- codex_bot-0.1.0/tools/__init__.py +0 -0
- codex_bot-0.1.0/tools/dev/__init__.py +0 -0
- codex_bot-0.1.0/tools/dev/check.py +245 -0
- codex_bot-0.1.0/tools/dev/generate_project_tree.py +119 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# codex-bot β agent quick reference
|
|
2
|
+
|
|
3
|
+
## Memory
|
|
4
|
+
`C:\Users\prime\.claude\projects\C--install-progect-codex-bot\memory\MEMORY.md`
|
|
5
|
+
|
|
6
|
+
## Project
|
|
7
|
+
- Package: `C:/install/progect/codex_bot/`
|
|
8
|
+
- Source: `C:/install/progect/lily_website/src/telegram_bot/`
|
|
9
|
+
- Status: Π²ΡΠ΅ ΠΌΠΎΠ΄ΡΠ»ΠΈ ΡΠ΅Π°Π»ΠΈΠ·ΠΎΠ²Π°Π½Ρ, ΠΈΠ΄ΡΡ code review
|
|
10
|
+
|
|
11
|
+
## Dev commands
|
|
12
|
+
```bash
|
|
13
|
+
cd C:/install/progect/codex_bot
|
|
14
|
+
mkdocs build --strict # ΠΏΡΠΎΠ²Π΅ΡΠΊΠ° Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΠΈ
|
|
15
|
+
ruff check src/ # Π»ΠΈΠ½ΡΠΈΠ½Π³
|
|
16
|
+
mypy src/ # ΡΠΈΠΏΡ
|
|
17
|
+
python -c "import codex_bot; print('ok')"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Key conventions
|
|
21
|
+
- ΠΡΠ΅ DTO: `frozen=True`, ΠΌΡΡΠ°ΡΠΈΠΈ ΡΠ΅ΡΠ΅Π· `model_copy(update=...)`
|
|
22
|
+
- ΠΡΠΊΠ΅ΡΡΡΠ°ΡΠΎΡΡ: stateless singleton, `Generic[PayloadT]`
|
|
23
|
+
- Redis: SET NX (Π°ΡΠΎΠΌΠ°ΡΠ½ΠΎ), Π½Π΅ EXISTS + SET
|
|
24
|
+
- ImportError: ΠΏΡΠΎΠ²Π΅ΡΡΠ΅ΠΌ `e.name == module_path` (ΡΠΌΠ½ΡΠΉ Fail Fast)
|
|
25
|
+
- engine/ = ΠΈΠ½ΡΡΠ°ΡΡΡΡΠΊΡΡΡΠ° "ΠΏΠΎΠ΄ ΠΊΠ°ΠΏΠΎΡΠΎΠΌ", Π½Π΅ ΠΏΡΠ±Π»ΠΈΡΠ½ΡΠΉ API
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(pip install -e \".[docs]\" -q)",
|
|
5
|
+
"Bash(python -c \"from codex_bot.base import BaseBotOrchestrator, UnifiedViewDTO, ViewResultDTO, BaseBotContext, MenuViewDTO, MessageCoordsDTO; print\\(''OK:'', BaseBotOrchestrator, UnifiedViewDTO\\)\")",
|
|
6
|
+
"Bash(mkdocs build --strict)",
|
|
7
|
+
"Bash(pip show mkdocs mkdocs-material)"
|
|
8
|
+
]
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Deploy Docs to GitHub Pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
deploy-docs:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
with:
|
|
20
|
+
fetch-depth: 0
|
|
21
|
+
|
|
22
|
+
- name: Configure Git Credentials
|
|
23
|
+
run: |
|
|
24
|
+
git config user.name github-actions[bot]
|
|
25
|
+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
|
26
|
+
|
|
27
|
+
- name: Set up Python
|
|
28
|
+
uses: actions/setup-python@v5
|
|
29
|
+
with:
|
|
30
|
+
python-version: "3.12"
|
|
31
|
+
|
|
32
|
+
- name: Install dependencies
|
|
33
|
+
run: |
|
|
34
|
+
python -m pip install --upgrade pip
|
|
35
|
+
pip install -e ".[docs,all]"
|
|
36
|
+
|
|
37
|
+
- name: Build and deploy docs
|
|
38
|
+
run: |
|
|
39
|
+
mkdocs gh-deploy --force
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# --- Python Core ---
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
env/
|
|
8
|
+
venv/
|
|
9
|
+
.venv/
|
|
10
|
+
ENV/
|
|
11
|
+
|
|
12
|
+
# --- Build & Distribution ---
|
|
13
|
+
build/
|
|
14
|
+
develop-eggs/
|
|
15
|
+
dist/
|
|
16
|
+
downloads/
|
|
17
|
+
eggs/
|
|
18
|
+
.eggs/
|
|
19
|
+
lib/
|
|
20
|
+
lib64/
|
|
21
|
+
parts/
|
|
22
|
+
sdist/
|
|
23
|
+
var/
|
|
24
|
+
wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# --- Testing & Coverage ---
|
|
31
|
+
.tox/
|
|
32
|
+
.nox/
|
|
33
|
+
.coverage
|
|
34
|
+
.coverage.*
|
|
35
|
+
.cache
|
|
36
|
+
nosetests.xml
|
|
37
|
+
coverage.xml
|
|
38
|
+
*.cover
|
|
39
|
+
*.py.cover
|
|
40
|
+
.hypothesis/
|
|
41
|
+
.pytest_cache/
|
|
42
|
+
htmlcov/
|
|
43
|
+
|
|
44
|
+
# --- Documentation ---
|
|
45
|
+
site/
|
|
46
|
+
docs/_build/
|
|
47
|
+
|
|
48
|
+
# --- Linting & Typing ---
|
|
49
|
+
.mypy_cache/
|
|
50
|
+
.ruff_cache/
|
|
51
|
+
.dmypy.json
|
|
52
|
+
dmypy.json
|
|
53
|
+
.pyre/
|
|
54
|
+
.pytype/
|
|
55
|
+
|
|
56
|
+
# --- IDEs & Editors ---
|
|
57
|
+
.idea/
|
|
58
|
+
.vscode/
|
|
59
|
+
*.swp
|
|
60
|
+
*.swo
|
|
61
|
+
.DS_Store
|
|
62
|
+
|
|
63
|
+
# --- Project Specific ---
|
|
64
|
+
.env
|
|
65
|
+
.envrc
|
|
66
|
+
*.log
|
|
67
|
+
# Temporary files from LocalesCompiler (if they leak into root)
|
|
68
|
+
bot_locales_*
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v5.0.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: check-yaml
|
|
8
|
+
- id: check-json
|
|
9
|
+
- id: check-added-large-files
|
|
10
|
+
args: ['--maxkb=2000']
|
|
11
|
+
- id: check-merge-conflict
|
|
12
|
+
|
|
13
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
14
|
+
rev: v0.9.6
|
|
15
|
+
hooks:
|
|
16
|
+
- id: ruff
|
|
17
|
+
args: [--fix]
|
|
18
|
+
- id: ruff-format
|
|
19
|
+
|
|
20
|
+
- repo: https://github.com/igorshubovych/markdownlint-cli
|
|
21
|
+
rev: v0.44.0
|
|
22
|
+
hooks:
|
|
23
|
+
- id: markdownlint
|
|
24
|
+
args: ["--fix", "--disable", "MD013"]
|
|
25
|
+
|
|
26
|
+
- repo: https://github.com/PyCQA/bandit
|
|
27
|
+
rev: 1.8.2
|
|
28
|
+
hooks:
|
|
29
|
+
- id: bandit
|
|
30
|
+
args: ["-c", "pyproject.toml"]
|
|
31
|
+
additional_dependencies: ["bandit[toml]"]
|
|
32
|
+
|
|
33
|
+
# 2. ΠΠΎΠΈΡΠΊ "Π·Π°Π±ΡΡΡΡ
" ΡΠ΅ΠΊΡΠ΅ΡΠΎΠ² ΠΈ ΠΏΠ°ΡΠΎΠ»Π΅ΠΉ (ΡΡΠΈΠ»Π΅Π½Π½ΡΠΉ)
|
|
34
|
+
- repo: https://github.com/Yelp/detect-secrets
|
|
35
|
+
rev: v1.5.0
|
|
36
|
+
hooks:
|
|
37
|
+
- id: detect-secrets
|
|
38
|
+
# Baseline will be added after manual creation
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2025-03-09
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Initial Library Release**: Migration and adaptation of core infrastructure from production projects into a reusable feature-based framework.
|
|
12
|
+
- **Feature-based Architecture**: Implementation of `BaseBotOrchestrator` and `Director` for stateless UI management.
|
|
13
|
+
- **Redis Integration**: Stream processing, consumer groups support, and Redis-based dispatching.
|
|
14
|
+
- **FSM Enhancements**: `GarbageStateRegistry` for automatic UI cleanup and advanced state management.
|
|
15
|
+
- **Unified View System**: `ViewSender` and `UnifiedViewDTO` for consistent message rendering across different platforms.
|
|
16
|
+
- **I18n Engine**: Custom Fluent-based locales compiler with isolation support.
|
|
17
|
+
- **CLI Tools**: Scaffolding templates for rapid feature development.
|
|
18
|
+
- **Multi-language Documentation**: Comprehensive guides and API references in English and Russian.
|
|
19
|
+
- **DevOps Infrastructure**: Pre-commit hooks, Ruff/Mypy configurations, and GitHub Actions for docs.
|
|
20
|
+
- **Final Polish**: Refined `Director` logic, `BotBuilder` factory, and `RouterBuilder` for better stability.
|
|
21
|
+
- **Enhanced State Management**: Improved `StateManager` and `FSM` handlers for more robust session control.
|
|
22
|
+
- **Redis Dispatcher Optimization**: Fine-tuned stream processing and error handling in `RedisDispatcher`.
|
|
23
|
+
- **Test Coverage**: Added comprehensive unit tests for all core modules.
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
- Refactored production code into a modular library structure.
|
|
27
|
+
- Standardized DTOs and protocols for better extensibility.
|
|
28
|
+
- Optimized Redis Stream processing for high-load scenarios.
|
|
29
|
+
- Improved type safety across the entire codebase (Mypy strict mode).
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# codex-bot β AI Context
|
|
2
|
+
|
|
3
|
+
Feature-based Aiogram framework library. MIT license, public GitHub.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Agent Memory
|
|
8
|
+
|
|
9
|
+
> **Memory directory:** `C:\Users\prime\.claude\projects\C--install-progect-codex-bot\memory\`
|
|
10
|
+
>
|
|
11
|
+
> ΠΠ³Π΅Π½Ρ ΠΈΠ· Π»ΡΠ±ΠΎΠ³ΠΎ ΠΏΡΠΎΠ΅ΠΊΡΠ°: ΡΠΈΡΠ°ΠΉ `MEMORY.md` ΡΠ°ΠΌ β ΡΡΠΎ ΠΈΠ½Π΄Π΅ΠΊΡ.
|
|
12
|
+
> ΠΠ΅ΡΠ°Π»ΠΈ Π²: `architecture.md`, `modules.md`, `fixes.md`
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Π‘ΡΡΡΠΊΡΡΡΠ° ΠΏΠ°ΠΊΠ΅ΡΠ°
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
src/codex_bot/
|
|
20
|
+
βββ base/ β BaseBotOrchestrator[T] (ABC), UnifiedViewDTO, ViewResultDTO
|
|
21
|
+
βββ director/ β Director, OrchestratorProtocol, ContainerProtocol, SceneConfig
|
|
22
|
+
βββ fsm/ β BaseStateManager, GarbageStateRegistry, common_fsm_router
|
|
23
|
+
βββ sender/ β ViewSender (stateless), SenderManager, SenderKeys
|
|
24
|
+
βββ redis/ β RedisRouter, BotRedisDispatcher, RedisStreamProcessor
|
|
25
|
+
βββ animation/ β UIAnimationService, AnimationType
|
|
26
|
+
βββ helper/ β ContextHelper
|
|
27
|
+
βββ url_signer/ β UrlSignerService
|
|
28
|
+
βββ engine/ β ΠΈΠ½ΡΡΠ°ΡΡΡΡΠΊΡΡΡΠ° "ΠΏΠΎΠ΄ ΠΊΠ°ΠΏΠΎΡΠΎΠΌ"
|
|
29
|
+
βββ middlewares/ β ThrottlingMiddleware, ContainerMiddleware, UserValidationMiddleware
|
|
30
|
+
βββ discovery/ β FeatureDiscoveryService (service.py)
|
|
31
|
+
βββ factory/ β BotBuilder (bot_builder.py)
|
|
32
|
+
βββ router_builder/ β collect_feature_routers, build_main_router (router_builder.py)
|
|
33
|
+
βββ http/ β BaseApiClient, ApiClientError (api_client.py)
|
|
34
|
+
βββ i18n/ β compile_locales (locales_compiler.py)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Π‘ΡΠ°Π½Π΄Π°ΡΡΡ (ΠΎΠ±ΡΠ·Π°ΡΠ΅Π»ΡΠ½ΠΎ)
|
|
40
|
+
|
|
41
|
+
- **Packaging**: Hatchling, PEP 621
|
|
42
|
+
- **Docstrings**: Google style β Args / Returns / Example
|
|
43
|
+
- **Docs**: MkDocs Material + mkdocstrings
|
|
44
|
+
- **DTO**: `frozen=True, arbitrary_types_allowed=True`, ΠΌΡΡΠ°ΡΠΈΠΈ ΡΠ΅ΡΠ΅Π· `model_copy(update=...)`
|
|
45
|
+
- **ΠΡΠΊΠ΅ΡΡΡΠ°ΡΠΎΡΡ**: stateless `Generic[PayloadT]`, `director` ΡΠ²Π½ΡΠΉ Π°ΡΠ³ΡΠΌΠ΅Π½Ρ
|
|
46
|
+
- **Fail Fast**: ΡΠΌΠ½ΡΠΉ `except ImportError` (ΠΏΡΠΎΠ²Π΅ΡΡΠ΅ΠΌ `e.name == module_path`)
|
|
47
|
+
- **Redis**: SET NX Π²ΠΌΠ΅ΡΡΠΎ EXISTS + SET (Π°ΡΠΎΠΌΠ°ΡΠ½ΠΎ, Π½Π΅Ρ race condition)
|
|
48
|
+
- **SecurityMiddleware**: ΡΠ΄Π°Π»ΡΠ½ Π½Π°Π²ΡΠ΅Π³Π΄Π° (ΠΈΠ»Π»ΡΠ·ΠΎΡΠ½Π°Ρ Π·Π°ΡΠΈΡΠ° + Π»ΠΈΡΠ½ΠΈΠΉ HGETALL)
|
codex_bot-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CodexDLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
codex_bot-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codex-bot
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Feature-based Aiogram framework library β reusable infrastructure for Telegram bots
|
|
5
|
+
Author: Codex Team
|
|
6
|
+
License: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: aiogram,bot,framework,telegram
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Framework :: AsyncIO
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Topic :: Communications :: Chat
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
16
|
+
Requires-Python: >=3.12
|
|
17
|
+
Requires-Dist: aiogram<4.0,>=3.4
|
|
18
|
+
Requires-Dist: pydantic<3.0,>=2.0
|
|
19
|
+
Provides-Extra: all
|
|
20
|
+
Requires-Dist: aiogram-i18n>=1.4; extra == 'all'
|
|
21
|
+
Requires-Dist: arq>=0.25; extra == 'all'
|
|
22
|
+
Requires-Dist: httpx<1.0,>=0.27; extra == 'all'
|
|
23
|
+
Requires-Dist: redis[asyncio]<6.0,>=5.0; extra == 'all'
|
|
24
|
+
Provides-Extra: arq
|
|
25
|
+
Requires-Dist: arq>=0.25; extra == 'arq'
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: bandit>=1.7; extra == 'dev'
|
|
28
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
29
|
+
Requires-Dist: pre-commit>=3.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
34
|
+
Provides-Extra: docs
|
|
35
|
+
Requires-Dist: mkdocs-material>=9.0; extra == 'docs'
|
|
36
|
+
Requires-Dist: mkdocs>=1.5; extra == 'docs'
|
|
37
|
+
Requires-Dist: mkdocstrings[python]>=0.24; extra == 'docs'
|
|
38
|
+
Provides-Extra: http
|
|
39
|
+
Requires-Dist: httpx<1.0,>=0.27; extra == 'http'
|
|
40
|
+
Provides-Extra: i18n
|
|
41
|
+
Requires-Dist: aiogram-i18n>=1.4; extra == 'i18n'
|
|
42
|
+
Provides-Extra: redis
|
|
43
|
+
Requires-Dist: redis[asyncio]<6.0,>=5.0; extra == 'redis'
|
|
44
|
+
Description-Content-Type: text/markdown
|
|
45
|
+
|
|
46
|
+
# Codex Bot Framework
|
|
47
|
+
|
|
48
|
+
[](https://pypi.org/project/codex-bot/)
|
|
49
|
+
[](https://pypi.org/project/codex-bot/)
|
|
50
|
+
[](https://opensource.org/licenses/MIT)
|
|
51
|
+
|
|
52
|
+
**Codex Bot** is a professional, feature-based framework built on top of [Aiogram 3.x](https://github.com/aiogram/aiogram). It provides a reusable, production-ready infrastructure for building complex, scalable Telegram bots with a focus on stateless UI management and high-load Redis integration.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## π Key Features
|
|
57
|
+
|
|
58
|
+
- **Feature-based Architecture**: Organize your bot into independent, reusable features.
|
|
59
|
+
- **Stateless Orchestrators**: Manage UI logic without storing state in memory, making your bot horizontally scalable.
|
|
60
|
+
- **Redis Stream Integration**: Native support for high-load event processing with Consumer Groups.
|
|
61
|
+
- **Advanced FSM**: Automatic UI cleanup with `GarbageStateRegistry` and structured state management.
|
|
62
|
+
- **Unified View System**: Consistent message rendering across different platforms using DTOs.
|
|
63
|
+
- **Fluent-based I18n**: Powerful localization engine with project-level isolation and automatic compilation.
|
|
64
|
+
- **CLI Scaffolding**: Rapidly generate new features with pre-defined templates.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## π¦ Installation
|
|
69
|
+
|
|
70
|
+
Install the core library:
|
|
71
|
+
```bash
|
|
72
|
+
pip install codex-bot
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Install with optional dependencies:
|
|
76
|
+
```bash
|
|
77
|
+
pip install "codex-bot[redis,i18n,http]"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## π Quick Start
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from codex_bot import BotBuilder, BaseBotOrchestrator, Director
|
|
86
|
+
from codex_bot.base.view_dto import ViewResultDTO
|
|
87
|
+
|
|
88
|
+
# 1. Define your feature orchestrator
|
|
89
|
+
class MyFeatureOrchestrator(BaseBotOrchestrator[None]):
|
|
90
|
+
async def render_content(self, payload: None, director: Director) -> ViewResultDTO:
|
|
91
|
+
return ViewResultDTO(text="Hello from Codex Bot!")
|
|
92
|
+
|
|
93
|
+
# 2. Build and run your bot
|
|
94
|
+
builder = BotBuilder(token="YOUR_TELEGRAM_TOKEN")
|
|
95
|
+
builder.register_orchestrator("main", MyFeatureOrchestrator())
|
|
96
|
+
builder.run_polling()
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## π Documentation
|
|
102
|
+
|
|
103
|
+
- [English Documentation](https://codex-team.github.io/codex_bot/en_EN/)
|
|
104
|
+
- [Π ΡΡΡΠΊΠ°Ρ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΡ](https://codex-team.github.io/codex_bot/ru_RU/)
|
|
105
|
+
- [**Changelog**](CHANGELOG.md) β see what's new in the latest versions.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## π License
|
|
110
|
+
|
|
111
|
+
This project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for details.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### π·πΊ ΠΡΠ°ΡΠΊΠΎΠ΅ ΠΎΠΏΠΈΡΠ°Π½ΠΈΠ΅ (RU)
|
|
116
|
+
**Codex Bot** β ΡΡΠΎ ΠΏΡΠΎΡΠ΅ΡΡΠΈΠΎΠ½Π°Π»ΡΠ½ΡΠΉ ΡΡΠ΅ΠΉΠΌΠ²ΠΎΡΠΊ Π΄Π»Ρ ΡΠΎΠ·Π΄Π°Π½ΠΈΡ Telegram-Π±ΠΎΡΠΎΠ² Π½Π° Π±Π°Π·Π΅ Aiogram 3.x. ΠΠ½ ΠΏΡΠ΅Π΄ΠΎΡΡΠ°Π²Π»ΡΠ΅Ρ Π³ΠΎΡΠΎΠ²ΡΡ ΠΈΠ½ΡΡΠ°ΡΡΡΡΠΊΡΡΡΡ Π΄Π»Ρ ΡΠ°Π·ΡΠ°Π±ΠΎΡΠΊΠΈ ΡΠ»ΠΎΠΆΠ½ΡΡ
ΠΈ ΠΌΠ°ΡΡΡΠ°Π±ΠΈΡΡΠ΅ΠΌΡΡ
ΡΠΈΡΡΠ΅ΠΌ, ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΡ Π°ΡΡ
ΠΈΡΠ΅ΠΊΡΡΡΡ Π½Π° ΠΎΡΠ½ΠΎΠ²Π΅ "ΡΠΈΡ", stateless-ΠΎΡΠΊΠ΅ΡΡΡΠ°ΡΠΎΡΡ ΠΈ Π³Π»ΡΠ±ΠΎΠΊΡΡ ΠΈΠ½ΡΠ΅Π³ΡΠ°ΡΠΈΡ Ρ Redis Streams.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Codex Bot Framework
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/codex-bot/)
|
|
4
|
+
[](https://pypi.org/project/codex-bot/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
**Codex Bot** is a professional, feature-based framework built on top of [Aiogram 3.x](https://github.com/aiogram/aiogram). It provides a reusable, production-ready infrastructure for building complex, scalable Telegram bots with a focus on stateless UI management and high-load Redis integration.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## π Key Features
|
|
12
|
+
|
|
13
|
+
- **Feature-based Architecture**: Organize your bot into independent, reusable features.
|
|
14
|
+
- **Stateless Orchestrators**: Manage UI logic without storing state in memory, making your bot horizontally scalable.
|
|
15
|
+
- **Redis Stream Integration**: Native support for high-load event processing with Consumer Groups.
|
|
16
|
+
- **Advanced FSM**: Automatic UI cleanup with `GarbageStateRegistry` and structured state management.
|
|
17
|
+
- **Unified View System**: Consistent message rendering across different platforms using DTOs.
|
|
18
|
+
- **Fluent-based I18n**: Powerful localization engine with project-level isolation and automatic compilation.
|
|
19
|
+
- **CLI Scaffolding**: Rapidly generate new features with pre-defined templates.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## π¦ Installation
|
|
24
|
+
|
|
25
|
+
Install the core library:
|
|
26
|
+
```bash
|
|
27
|
+
pip install codex-bot
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Install with optional dependencies:
|
|
31
|
+
```bash
|
|
32
|
+
pip install "codex-bot[redis,i18n,http]"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## π Quick Start
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from codex_bot import BotBuilder, BaseBotOrchestrator, Director
|
|
41
|
+
from codex_bot.base.view_dto import ViewResultDTO
|
|
42
|
+
|
|
43
|
+
# 1. Define your feature orchestrator
|
|
44
|
+
class MyFeatureOrchestrator(BaseBotOrchestrator[None]):
|
|
45
|
+
async def render_content(self, payload: None, director: Director) -> ViewResultDTO:
|
|
46
|
+
return ViewResultDTO(text="Hello from Codex Bot!")
|
|
47
|
+
|
|
48
|
+
# 2. Build and run your bot
|
|
49
|
+
builder = BotBuilder(token="YOUR_TELEGRAM_TOKEN")
|
|
50
|
+
builder.register_orchestrator("main", MyFeatureOrchestrator())
|
|
51
|
+
builder.run_polling()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## π Documentation
|
|
57
|
+
|
|
58
|
+
- [English Documentation](https://codex-team.github.io/codex_bot/en_EN/)
|
|
59
|
+
- [Π ΡΡΡΠΊΠ°Ρ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΡ](https://codex-team.github.io/codex_bot/ru_RU/)
|
|
60
|
+
- [**Changelog**](CHANGELOG.md) β see what's new in the latest versions.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## π License
|
|
65
|
+
|
|
66
|
+
This project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for details.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
### π·πΊ ΠΡΠ°ΡΠΊΠΎΠ΅ ΠΎΠΏΠΈΡΠ°Π½ΠΈΠ΅ (RU)
|
|
71
|
+
**Codex Bot** β ΡΡΠΎ ΠΏΡΠΎΡΠ΅ΡΡΠΈΠΎΠ½Π°Π»ΡΠ½ΡΠΉ ΡΡΠ΅ΠΉΠΌΠ²ΠΎΡΠΊ Π΄Π»Ρ ΡΠΎΠ·Π΄Π°Π½ΠΈΡ Telegram-Π±ΠΎΡΠΎΠ² Π½Π° Π±Π°Π·Π΅ Aiogram 3.x. ΠΠ½ ΠΏΡΠ΅Π΄ΠΎΡΡΠ°Π²Π»ΡΠ΅Ρ Π³ΠΎΡΠΎΠ²ΡΡ ΠΈΠ½ΡΡΠ°ΡΡΡΡΠΊΡΡΡΡ Π΄Π»Ρ ΡΠ°Π·ΡΠ°Π±ΠΎΡΠΊΠΈ ΡΠ»ΠΎΠΆΠ½ΡΡ
ΠΈ ΠΌΠ°ΡΡΡΠ°Π±ΠΈΡΡΠ΅ΠΌΡΡ
ΡΠΈΡΡΠ΅ΠΌ, ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΡ Π°ΡΡ
ΠΈΡΠ΅ΠΊΡΡΡΡ Π½Π° ΠΎΡΠ½ΠΎΠ²Π΅ "ΡΠΈΡ", stateless-ΠΎΡΠΊΠ΅ΡΡΡΠ°ΡΠΎΡΡ ΠΈ Π³Π»ΡΠ±ΠΎΠΊΡΡ ΠΈΠ½ΡΠ΅Π³ΡΠ°ΡΠΈΡ Ρ Redis Streams.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# π§ Documentation Standard for codex-bot
|
|
2
|
+
|
|
3
|
+
> **AUTHORITY:** This document defines how documentation is written, structured, and maintained in the `codex-bot` library.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. π Core Philosophy
|
|
8
|
+
|
|
9
|
+
We maintain documentation in **two languages** to ensure international accessibility while keeping the local community engaged.
|
|
10
|
+
|
|
11
|
+
### π¬π§ English (Primary / Technical Truth)
|
|
12
|
+
|
|
13
|
+
- **Mandatory for:** All Pull Requests and technical specifications.
|
|
14
|
+
- **Location:**
|
|
15
|
+
- `docs/api/` β Technical API reference (auto-generated from docstrings).
|
|
16
|
+
- `docs/en_EN/` β Conceptual guides and architectural mirroring.
|
|
17
|
+
- **Content:**
|
|
18
|
+
- Full technical specifications.
|
|
19
|
+
- API documentation (via `docs/api/`).
|
|
20
|
+
- Code examples and integration guides.
|
|
21
|
+
- **Goal:** Single source of truth. If code contradicts EN docs, it is a bug.
|
|
22
|
+
|
|
23
|
+
### π·πΊ Russian (Secondary / Conceptual Hub)
|
|
24
|
+
|
|
25
|
+
- **Optional for Contributors:** If you don't speak Russian, write EN docs. Maintainers will add RU translation.
|
|
26
|
+
- **Location:** `docs/ru_RU/` (mirrors folder structure).
|
|
27
|
+
- **Content:**
|
|
28
|
+
- Conceptual translation (the "why" and "how").
|
|
29
|
+
- Links to `docs/api/` for technical details instead of duplication.
|
|
30
|
+
- Architect's mental model and design decision explanations.
|
|
31
|
+
- **Goal:** Help Russian-speaking developers understand the "why" behind the framework's architecture.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 2. β―οΈ Twin Realms Principle
|
|
36
|
+
|
|
37
|
+
Documentation languages serve different purposes:
|
|
38
|
+
|
|
39
|
+
### π¬π§ EN = Technical Truth
|
|
40
|
+
|
|
41
|
+
- **For:** AI generators, external libraries, standards compliance.
|
|
42
|
+
- **Format:** Granular (mirrors `src/codex_bot/` structure).
|
|
43
|
+
- **Contains:**
|
|
44
|
+
- API Reference (in `docs/api/`).
|
|
45
|
+
- Mermaid Diagrams (Sequence, Class, ER).
|
|
46
|
+
- Integration patterns.
|
|
47
|
+
|
|
48
|
+
### π·πΊ RU = Architect's Mind
|
|
49
|
+
|
|
50
|
+
- **For:** Human developers, system understanding.
|
|
51
|
+
- **Format:** Aggregated (1 folder = 1 README).
|
|
52
|
+
- **Contains:**
|
|
53
|
+
- **The Why:** Why this solution (e.g., why Stateless Orchestrators) was chosen.
|
|
54
|
+
- **The Flow:** How data flows through the system (simplified).
|
|
55
|
+
- **Links:** References to `docs/api/` files for technical details.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 3. ποΈ Structure Mirroring Rule
|
|
60
|
+
|
|
61
|
+
Documentation structure **MUST** mirror the code structure in `src/codex_bot/`.
|
|
62
|
+
|
|
63
|
+
### Mapping Example
|
|
64
|
+
|
|
65
|
+
| Code Location | Documentation Location (EN/RU) |
|
|
66
|
+
|:---|:---|
|
|
67
|
+
| `src/codex_bot/base/` | `docs/[lang]/architecture/base/` |
|
|
68
|
+
| `src/codex_bot/engine/router_builder/` | `docs/[lang]/architecture/engine/router_builder/` |
|
|
69
|
+
| `src/codex_bot/redis/` | `docs/[lang]/architecture/redis/` |
|
|
70
|
+
|
|
71
|
+
### Why?
|
|
72
|
+
|
|
73
|
+
- **1:1 Mapping:** Easy to find docs for any code module.
|
|
74
|
+
- **No Orphans:** Prevents documentation from getting lost.
|
|
75
|
+
- **Refactoring Safety:** When code moves, docs move with it.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 4. π§ Navigation Standard
|
|
80
|
+
|
|
81
|
+
Every documentation file must be easily navigable.
|
|
82
|
+
|
|
83
|
+
### Breadcrumbs (Mandatory)
|
|
84
|
+
|
|
85
|
+
Every file **MUST** start with a navigation header:
|
|
86
|
+
|
|
87
|
+
```markdown
|
|
88
|
+
[β¬
οΈ Back](../README.md) | [π Docs Root](../../README.md)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
- **Back:** Links to the current directory's `README.md`.
|
|
92
|
+
- **Docs Root:** Links to the documentation root (`docs/README.md`).
|
|
93
|
+
|
|
94
|
+
### Index Files (README.md)
|
|
95
|
+
|
|
96
|
+
Every directory **MUST** have a `README.md` acting as a navigation hub.
|
|
97
|
+
|
|
98
|
+
**Required Structure:**
|
|
99
|
+
|
|
100
|
+
1. **Header:** Emoji π + Section Name.
|
|
101
|
+
2. **Navigation:** Breadcrumbs.
|
|
102
|
+
3. **Description:** Short summary (2-3 sentences).
|
|
103
|
+
4. **Map:** Table or list of files in **logical reading order** (not alphabetical).
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 5. π File Naming & Organization
|
|
108
|
+
|
|
109
|
+
### Naming Conventions
|
|
110
|
+
|
|
111
|
+
- **Format:** `snake_case.md` (e.g., `orchestrator_logic.md`).
|
|
112
|
+
- **No Prefixes:** Do NOT use `01_`, `02_` prefixes in filenames.
|
|
113
|
+
- **Reading Order:** Defined in `README.md` map.
|
|
114
|
+
|
|
115
|
+
### Language Folders
|
|
116
|
+
|
|
117
|
+
All documents **MUST** reside in:
|
|
118
|
+
|
|
119
|
+
- `docs/api/` (Technical EN)
|
|
120
|
+
- `docs/en_EN/` (Conceptual EN)
|
|
121
|
+
- `docs/ru_RU/` (Conceptual RU)
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## 6. β
Markdown Linting Rules (Strict)
|
|
126
|
+
|
|
127
|
+
1. **MD047 (End with Newline):** Every file must end with exactly **one newline** (`\n`).
|
|
128
|
+
2. **MD032 (List Spacing):** Blank line before and after any list.
|
|
129
|
+
3. **MD007 (Indentation):** Use **2 spaces** for nested lists.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 7. π« Common Mistakes
|
|
134
|
+
|
|
135
|
+
- **β Duplicating Code in RU Docs:** Link to `docs/api/` instead.
|
|
136
|
+
- **β Numbered Prefixes:** Use `README.md` map for order.
|
|
137
|
+
- **β Missing Breadcrumbs:** Always add the navigation header.
|
|
138
|
+
- **β Language-neutral folders:** Use `en_EN` or `ru_RU`.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
**Last Updated:** 2025-02-07
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# π€ codex-bot Documentation
|
|
2
|
+
|
|
3
|
+
Welcome to the official documentation for `codex-bot` β a feature-based Aiogram framework library for building scalable Telegram bots.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## π Choose Your Language
|
|
8
|
+
|
|
9
|
+
| Language | Description |
|
|
10
|
+
|:---|:---|
|
|
11
|
+
| **[π¬π§ English](./en_EN/README.md)** | Primary documentation, conceptual guides, and architecture. |
|
|
12
|
+
| **[π·πΊ Π ΡΡΡΠΊΠΈΠΉ](./ru_RU/README.md)** | Conceptual translation and architect's mental model. |
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## π Technical Reference
|
|
17
|
+
|
|
18
|
+
| Section | Description |
|
|
19
|
+
|:---|:---|
|
|
20
|
+
| **[π οΈ API Reference](./api/README.md)** | Full technical API documentation generated from code docstrings. |
|
|
21
|
+
| **[π§ Documentation Standard](./DOCUMENTATION_STANDARD.md)** | How we write and structure documentation in this project. |
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## π Quick Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install codex-bot # core only
|
|
29
|
+
pip install codex-bot[redis] # + Redis support
|
|
30
|
+
pip install codex-bot[redis,arq,i18n] # + background tasks + i18n
|
|
31
|
+
pip install codex-bot[all] # everything
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
**Last Updated:** 2025-02-07
|