Skip to content

Commit 1250e90

Browse files
committed
initialize Retype project and add initial core documentation
1 parent 8bd50da commit 1250e90

File tree

20 files changed

+549
-48
lines changed

20 files changed

+549
-48
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish Retype powered website to GitHub Pages
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: retypeapp/action-build@latest
18+
19+
- uses: retypeapp/action-github-pages@latest
20+
with:
21+
update-branch: true

.gitignore

Lines changed: 136 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,136 @@
1-
.venv
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
.pnpm-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# Bower dependency directory (https://bower.io/)
33+
bower_components
34+
35+
# node-waf configuration
36+
.lock-wscript
37+
38+
# Compiled binary addons (https://nodejs.org/api/addons.html)
39+
build/Release
40+
41+
# Dependency directories
42+
node_modules/
43+
jspm_packages/
44+
45+
# Snowpack dependency directory (https://snowpack.dev/)
46+
web_modules/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Optional stylelint cache
58+
.stylelintcache
59+
60+
# Microbundle cache
61+
.rpt2_cache/
62+
.rts2_cache_cjs/
63+
.rts2_cache_es/
64+
.rts2_cache_umd/
65+
66+
# Optional REPL history
67+
.node_repl_history
68+
69+
# Output of 'npm pack'
70+
*.tgz
71+
72+
# Yarn Integrity file
73+
.yarn-integrity
74+
75+
# dotenv environment variable files
76+
.env
77+
.env.development.local
78+
.env.test.local
79+
.env.production.local
80+
.env.local
81+
82+
# parcel-bundler cache (https://parceljs.org/)
83+
.cache
84+
.parcel-cache
85+
86+
# Next.js build output
87+
.next
88+
out
89+
90+
# Nuxt.js build / generate output
91+
.nuxt
92+
dist
93+
94+
# Gatsby files
95+
.cache/
96+
# Comment in the public line in if your project uses Gatsby and not Next.js
97+
# https://nextjs.org/blog/next-9-1#public-directory-support
98+
# public
99+
100+
# vuepress build output
101+
.vuepress/dist
102+
103+
# vuepress v2.x temp and cache directory
104+
.temp
105+
.cache
106+
107+
# vitepress build output
108+
**/.vitepress/dist
109+
110+
# vitepress cache directory
111+
**/.vitepress/cache
112+
113+
# Docusaurus cache and generated files
114+
.docusaurus
115+
116+
# Serverless directories
117+
.serverless/
118+
119+
# FuseBox cache
120+
.fusebox/
121+
122+
# DynamoDB Local files
123+
.dynamodb/
124+
125+
# TernJS port file
126+
.tern-port
127+
128+
# Stores VSCode versions used for testing VSCode extensions
129+
.vscode-test
130+
131+
# yarn v2
132+
.yarn/cache
133+
.yarn/unplugged
134+
.yarn/build-state.yml
135+
.yarn/install-state.gz
136+
.pnp.*

.pre-commit-config.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.

core/config/base.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
date: 2025-06-21
3+
category: [core]
4+
tags: [BaseConfig, config, ClassVar]
5+
description: Base configuration class for ModuBotCore
6+
7+
author:
8+
- name: Endkind
9+
link: https://github.com/Endkind
10+
avatar: https://github.com/Endkind.png
11+
---
12+
13+
# BaseConfig
14+
15+
`BaseConfig` is the base class for all configuration classes in ModuBotCore. It provides automatic runtime type checking for class variables (`ClassVar`).
16+
17+
When you create a subclass of `BaseConfig`, all `ClassVar` attributes are validated to ensure their types match the declared types. This helps catch configuration errors early.
18+
19+
## Supported Types
20+
21+
- Primitive types: `str`, `int`, `float`, `bool`
22+
- Type wrappers, e.g., `Type[SomeClass]`
23+
24+
If a `ClassVar` has an invalid or unsupported value/type, a `TypeError` is raised at class creation time.
25+
26+
## Example
27+
28+
```python
29+
from typing import ClassVar
30+
from ModuBotCore.config import BaseConfig
31+
32+
class MyConfig(BaseConfig):
33+
NAME: ClassVar[str] = "MyBot"
34+
ENABLE_FEATURE: ClassVar[bool] = True
35+
TIMEOUT: ClassVar[int] = 30
36+
```
37+
38+
If you assign a wrong type, e.g. `NAME: ClassVar[str] = 123`, a `TypeError` will be raised immediately.
39+
40+
This ensures your configuration is always type-safe.

core/config/index.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
icon: gear

core/config/logger.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
date: 2025-06-21
3+
category: [core]
4+
tags: [logger, config, BaseConfig]
5+
description: Logger configuration for ModuBotCore
6+
7+
author:
8+
- name: Endkind
9+
link: https://github.com/Endkind
10+
avatar: https://github.com/Endkind.png
11+
---
12+
13+
# Logger Configuration
14+
15+
ModuBotCore provides a ready-to-use logger configuration via the `LoggerConfig` class.
16+
17+
## LoggerConfig
18+
19+
`LoggerConfig` inherits from `BaseConfig` and is a frozen dataclass. It defines the following class variables:
20+
21+
- `LEVEL`: Logging level (e.g., DEBUG, INFO). Defaults to the `LOG_LEVEL` environment variable or `'INFO'`.
22+
- `FORMAT`: Format string for log messages. Default: `"[%(asctime)s - %(levelname)s - %(name)s]: %(message)s"`
23+
- `DATEFMT`: Format string for timestamps in log messages. Default: `"%m/%d/%Y %H:%M:%S"`
24+
25+
You can use or override these settings in your own configuration if needed.
26+
27+
## Example
28+
29+
```python
30+
from ModuBotCore.config import LoggerConfig
31+
32+
print(LoggerConfig.LEVEL) # e.g., 'INFO'
33+
print(LoggerConfig.FORMAT) # e.g., '[%(asctime)s - %(levelname)s - %(name)s]: %(message)s'
34+
print(LoggerConfig.DATEFMT) # e.g., '%m/%d/%Y %H:%M:%S'
35+
```
36+
37+
These settings control the log output format and level for all logging in ModuBotCore.

core/core.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
date: 2025-06-21
3+
category: [core]
4+
tags: [core, ModuBotCore, customization]
5+
description: Usage and customization of ModuBotCore
6+
7+
author:
8+
- name: Endkind
9+
link: https://github.com/Endkind
10+
avatar: https://github.com/Endkind.png
11+
---
12+
13+
# ModuBotCore Usage
14+
15+
You can use the default core directly:
16+
17+
```python
18+
from ModuBotCore import ModuBotCore
19+
20+
ModuBotCore().run()
21+
```
22+
23+
Or you can customize it by creating your own class that inherits from `ModuBotCore`.
24+
25+
You have access to the logger via `self.logger`.
26+
27+
To start and stop the bot, use the `run()` and `stop()` methods.
28+
29+
## Important ClassVars
30+
31+
```python
32+
NAME: ClassVar[str] = "ModuBotCore"
33+
VERSION: ClassVar[str] = "0.0.1"
34+
LOGGER_CONFIG: ClassVar[Type[LoggerConfig]] = LoggerConfig
35+
MODULE_BASE_CLASS: ClassVar[Type[BaseModule]] = BaseModule
36+
```
37+
38+
## Example: Custom Core
39+
40+
```python
41+
from ModuBotCore import ModuBotCore
42+
from ModuBotCore.config import LoggerConfig
43+
44+
class MyLoggerConfig(LoggerConfig):
45+
LEVEL = "DEBUG"
46+
47+
class MyBot(ModuBotCore):
48+
NAME = "MyCustomBot"
49+
VERSION = "1.2.3"
50+
LOGGER_CONFIG = MyLoggerConfig
51+
52+
bot = MyBot()
53+
bot.run()
54+
```
55+
56+
This allows you to extend and modify the core functionality as needed.

core/helpers.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
date: 2025-06-21
3+
category: [core]
4+
tags: [helpers, str2bool]
5+
description: Overview of helpers in ModuBotCore
6+
7+
author:
8+
- name: Endkind
9+
link: https://github.com/Endkind
10+
avatar: https://github.com/Endkind.png
11+
---
12+
13+
# Helpers
14+
15+
ModuBotCore provides useful helper functions in `ModuBotCore.helpers`.
16+
17+
## str2bool
18+
19+
`str2bool(value: str) -> bool`
20+
21+
Converts a string to a boolean value. Useful for parsing configuration values or user input.
22+
23+
### Example
24+
25+
```python
26+
from ModuBotCore.helpers import str2bool
27+
28+
print(str2bool("true")) # True
29+
print(str2bool("False")) # False
30+
```

core/index.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
date: 2025-06-21
3+
category: [core]
4+
description: Overview of the ModuBotCore core features
5+
icon: heart
6+
7+
author:
8+
- name: Endkind
9+
link: https://github.com/Endkind
10+
avatar: https://github.com/Endkind.png
11+
---
12+
13+
# Core
14+
15+
This documentation covers the **core** of the ModuBot project. The core is provided as the Python package `ModuBotCore` and forms the foundation for building modular and extensible bots with ModuBot.
16+
17+
- Use the default core out of the box or extend it with your own classes.
18+
- Built-in configuration system with type checking.
19+
- Flexible logger configuration.
20+
- Easy module integration and management.
21+
22+
You can start ModuBotCore directly or customize its behavior by subclassing and overriding configuration options.
23+
24+
For more details, see:
25+
26+
- [Installation](./install.md)
27+
- [Core Usage](./core.md)
28+
- [Module System](./module.md)
29+
- [Helpers](./helpers.md)
30+
- [Base Configuration](./config/base.md)
31+
- [Logger Configuration](./config/logger.md)

0 commit comments

Comments
 (0)