No description
- Rust 65.1%
- HTML 24.7%
- Shell 5.8%
- TypeScript 2.9%
- Makefile 0.8%
- Other 0.7%
SSR page.html: Read/Stop button with TTS via hero_agent Added connection-status.js for status-dot support Signed-off-by: mik-tf |
||
|---|---|---|
| .forgejo/workflows | ||
| crates | ||
| deploy/single-vm | ||
| docs/manual | ||
| scripts | ||
| specs | ||
| src | ||
| tests/e2e | ||
| .env.example | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| rust-toolchain.toml | ||
| SKILL.md | ||
Hero Books - Document Management System
A Rust-based document collection management system with CLI, library, and web interfaces for processing markdown-based documentation with support for cross-collection references, link validation, AI processing, vector search, and export to self-contained directories.
# Source your environment variables
source ~/.config/env.sh # or wherever you keep your secrets
# Build, sync 3 libraries from Forge repos, and run
make run
# Or run the offline demo (7 local example books)
#make demo
# See all available commands
make help
Architecture
Workspace Layout
hero_books/
├── Cargo.toml # workspace root
├── Makefile # root build automation
├── scripts/buildenv.sh # project configuration
├── scripts/build_lib.sh # shared build functions
├── src/ # root library + server binary
├── templates/ # Askama HTML templates (dark theme)
├── crates/
│ ├── hero_books_sdk/ # library: generated OpenRPC client (openrpc_client! macro)
│ ├── hero_books_server/ # binary: OpenRPC daemon (Unix socket only)
│ ├── hero_books_admin/ # binary: Axum+HTML admin panel (uses SDK)
│ ├── hero_books_ui/ # binary: user-facing web interface (browsing, search)
│ └── hero_books_examples/ # examples: SDK usage demos
Dependency Graph
hero_books_sdk (no internal deps)
↑ ↑ ↑
| | |
server CLI UI
Sockets
All services communicate via Unix domain sockets only. No TCP ports are used.
| Component | Transport | Address |
|---|---|---|
| Server (OpenRPC) | Unix socket | ~/hero/var/sockets/hero_books_server.sock |
| Admin (Admin panel) | Unix socket | ~/hero/var/sockets/hero_books_admin.sock |
| UI (User-facing) | Unix socket | ~/hero/var/sockets/hero_books_ui.sock |
| Hero Embedder (dependency) | Unix socket | ~/hero/var/sockets/hero_embedder.sock |
Binaries
| Binary | Source | Purpose |
|---|---|---|
hero_books |
src/bin/hero_books.rs |
CLI lifecycle manager (start/stop/run/logs for hero_books_server) |
hero_books_server |
crates/hero_books_server/ |
OpenRPC daemon (Unix socket only) |
hero_books_admin |
crates/hero_books_admin/ |
Axum+HTML admin panel (uses SDK) |
hero_books_ui |
crates/hero_books_ui/ |
User-facing web interface (browsing, search) |
hero_docs |
src/bin/hero_docs.rs |
Generate Docusaurus sites from HeroScript ebook directories |
All binaries are installed to ~/hero/bin/.
Features
- Collection scanning: Automatically discover collections marked with
.collectionfiles - Cross-collection references: Link between pages in different collections using
collection:pagesyntax - Include directives: Embed content from other pages with
!!include collection:page - Link validation: Detect broken links to pages, images, and files
- AI processing: Q&A extraction, semantic search, ontology classification
- Vector search: Embeddings-powered semantic search via hero_embedder
- Export: Generate self-contained directories with all dependencies
- Access control: Group-based ACL via
.groupfiles - Admin dashboard: Web-based admin panel with settings, logs, and import management
- PDF generation: Convert books to PDF via Chrome
- MCP support: Model Context Protocol for AI tool integration
Installation
Install from Binaries
Download the pre-built binary from the Forge package registry:
mkdir -p ~/hero/bin
curl -fsSL -o ~/hero/bin/hero_books \
"https://forge.ourworld.tf/api/packages/lhumina_code/generic/hero_books/dev/hero_books-linux-amd64"
chmod +x ~/hero/bin/hero_books
Build from Source
git clone https://forge.ourworld.tf/lhumina_code/hero_books
cd hero_books
make build
Install to ~/hero/bin/:
make install
Run Different Documentation Sets
make run # 3 libraries from Forge repos (36 books, needs network on first run)
make demo # Local example books (7 books, offline, fast)
make stop # Stop all services
make status # Check service status
make logs # View server logs
make logs-ui # View UI logs
Environment Variables
This project follows the env_secrets convention. Source your env file before running.
source ~/.config/env.sh
make run
Variables used by Hero Books
| Variable | Required | Purpose |
|---|---|---|
GROQ_API_KEY |
Yes | Groq API for Q&A extraction and AI summary |
OPENROUTER_API_KEY |
Yes | OpenRouter API for LLM fallback |
SAMBANOVA_API_KEY |
No | SambaNova API for additional LLM provider |
GIT_TOKEN |
No | Personal access token for cloning private repos |
HEROBOOKS_PASSWORD |
No | HTTP Basic Auth password (username: hero) |
HERO_EMBEDDER_URL |
No | Override embedder endpoint (default: Unix socket) |
HERO_SECRET |
No | JWT shared secret for hero_auth integration |
HERO_AUTH_URL |
No | Hero Auth server URL for admin login |
CLI Usage
The hero_books CLI manages the service lifecycle via hero_proc.
# Start server in the background (managed by hero_proc)
hero_books start
# Start and stream logs (stops on Ctrl-C)
hero_books run
# Stop the server
hero_books stop
# Check server status
hero_books status
# View server logs
hero_books logs
Development
make build # Build release binaries
make check # Fast code check
make test # Run unit tests
make test-all # Full test suite (fmt, clippy, test, build, smoke, e2e)
make lint # Run clippy
make fmt # Format code
make rundev # Run in debug mode (uses hero_proc for process management)
make demo # Run with local example books
make install # Install release binaries to ~/hero/bin
make installdev # Install debug binaries to ~/hero/bin
License
Apache-2.0