2
0
Fork 0
forked from zynk/zynk

Commit links for !gitlog, full changelog link for !changelog, CMake, multi-file refactor

- !gitlog now shows a link to each commit in the repository, using the
  git remote URL converted from SSH/SCP to HTTPS
- !changelog now shows a 'Full changelog: <url>' link to CHANGELOG.md
  in the repository as the last message after all entries
- Removed 'full' keyword from !gitlog and !changelog (previously showed
  full commit messages and complete changelog entries)
- Switched build system from Make to CMake with feature toggles
  (-DWITH_<FEATURE>=ON/OFF)
- Refactored single-file codebase into dedicated header files: each
  command now lives in its own cmd_*.h file, with separate modules for
  database (db.h), IRC protocol (irc.h), networking (net.h), TLS (tls.h),
  and AI (ai.h)
- Updated README.md to reflect the simplified !gitlog and !changelog
  syntax and the new CMake build instructions

(0.40.0)
This commit is contained in:
Johannes Findeisen 2026-07-23 01:46:37 +02:00
commit 739e3622b5
34 changed files with 4317 additions and 3687 deletions

View file

@ -4,7 +4,7 @@ A single-file IRC bot in C. Features a key-value store backed by SQLite3, weathe
## Features
- **Key-Value Store**: Persist facts, notes, or any data with `zynk key = value`
- **Key-Value Store**: Persist facts, notes, or any data with `!zynk key = value`; Overwrite existing keys with `!zynk! key = value`
- **Weather**: Current conditions and 3-day forecasts via `wttr.in`
- **Stock Quotes**: Real-time stock prices via Yahoo Finance
- **Calculator**: Evaluate math expressions with `!calc`
@ -35,14 +35,73 @@ A single-file IRC bot in C. Features a key-value store backed by SQLite3, weathe
## Build
### Quick build
```sh
make
cmake -B build && cmake --build build
```
Set custom compiler or flags:
The binary is placed in `build/zynk`.
### Install
```sh
make CC=clang CFLAGS="-O2 -Wall -Wextra"
cmake --build build --target install
```
### Feature toggles
All commands are enabled by default. Disable any command at build time with `-DWITH_<FEATURE>=OFF`:
```sh
cmake -B build -DWITH_WEATHER=OFF -DWITH_AI=OFF
cmake --build build
```
Available options (the `!command` shown in parentheses):
| Option | Command | Description | Default |
|-------------------------|------------------|----------------------------------|---------|
| `WITH_ZYNK` | `!zynk` | Key-value store | ON |
| `WITH_PING` | `!ping` | Ping/pong | ON |
| `WITH_VERSION` | `!version` | Version info | ON |
| `WITH_HELP` | `!help` | Help listing | ON |
| `WITH_QUIT` | `!quit` / `!die` | Shut down the bot | ON |
| `WITH_WEATHER` | `!weather` | Weather lookup (requires curl) | ON |
| `WITH_FORECAST` | `!forecast` | 3-day forecast (requires curl) | ON |
| `WITH_STOCK` | `!stock` | Stock quotes (requires curl) | ON |
| `WITH_CALC` | `!calc` | Calculator (requires bc) | ON |
| `WITH_TIME` | `!time` | Time/timezone lookup | ON |
| `WITH_SEEN` | `!seen` | User tracking | ON |
| `WITH_TELL` | `!tell` | Offline messages | ON |
| `WITH_GITLOG` | `!gitlog` | Recent git commits | ON |
| `WITH_CHANGELOG` | `!changelog` | Changelog entries | ON |
| `WITH_AI` | `!ai` | AI questions (requires opencode) | ON |
| `WITH_CODE` | `!code` | AI code changes (ops only) | OFF |
| `WITH_REBUILD` | `!rebuild` | Rebuild & restart (ops only) | OFF |
| `WITH_UPTIME` | `!uptime` | Uptime display | ON |
| `WITH_RELOAD` | `!reload` | Hot reload (ops only) | ON |
| `WITH_RESTART` | `!restart` | Restart (ops only) | ON |
| `WITH_GREETING_OR_CHAT` | `<nick>: <text>` | Greeting/chat with AI fallback | ON |
### Minimal build
Disable everything except the core store, quit, and help:
```sh
cmake -B build \
-DWITH_PING=OFF -DWITH_VERSION=OFF -DWITH_WEATHER=OFF -DWITH_FORECAST=OFF \
-DWITH_STOCK=OFF -DWITH_CALC=OFF -DWITH_TIME=OFF -DWITH_SEEN=OFF \
-DWITH_TELL=OFF -DWITH_GITLOG=OFF -DWITH_CHANGELOG=OFF -DWITH_AI=OFF \
-DWITH_CODE=OFF -DWITH_REBUILD=OFF -DWITH_UPTIME=OFF -DWITH_RELOAD=OFF \
-DWITH_RESTART=OFF -DWITH_GREETING_OR_CHAT=OFF
cmake --build build
```
### Clean
```sh
rm -rf build
```
## Usage
@ -85,12 +144,12 @@ make CC=clang CFLAGS="-O2 -Wall -Wextra"
### Key-Value Store
| Command | Description |
|-------------------------|-----------------------------------------------|
| `zynk <key>` | Look up a stored value |
| `zynk <key> = <value>` | Store a value (key is lowercased) |
| `zynk! <key> = <value>` | Overwrite an existing value (ops in channels) |
| `zynk` | Get a random stored entry |
| Command | Description |
|------------------------------|-----------------------------------------------|
| `!zynk <key>` | Look up a stored value |
| `!zynk <key> = <value>` | Store a value (key is lowercased) |
| `!zynk! <key> = <value>` | Overwrite an existing value (ops in channels) |
| `!zynk` | Get a random stored entry |
### Weather & Finance
@ -108,8 +167,8 @@ make CC=clang CFLAGS="-O2 -Wall -Wextra"
| `!time [timezone]` | Show current time (see below) |
| `!seen <nick>` | Check when a user was last seen |
| `!tell <nick> <message>` | Leave a message for an offline user |
| `!gitlog [count] [full]` | Show recent git commits (default: 1, max: 5; `full` shows full commit messages) |
| `!changelog [count] [full]` | Show changelog entries (default: 1, max: 10; `full` shows full entry text) |
| `!gitlog [count]` | Show recent git commits with links (default: 5, max: 20) |
| `!changelog [count]` | Show changelog entries (default: 1, max: 10) |
#### Time (`!time`)