Initial commit

This commit is contained in:
Ignacio Ballesteros
2026-02-21 14:50:52 +01:00
commit 6b132b86e8
38 changed files with 2874 additions and 0 deletions

View File

@@ -0,0 +1,249 @@
# Agent Shell Transcript
**Agent:** OpenCode
**Started:** 2026-02-21 14:47:26
**Working Directory:** /home/ignaciobll/code/org-garden/
---
## User (2026-02-21 14:47:26)
/status
## User (2026-02-21 14:47:55)
Create a README.org explaining VERY briefly this project and how to run it.
## Agent (2026-02-21 14:47:56)
Let me explore the project structure first to understand what it is and how to run it.
### Tool Call [completed]: task
**Tool:** other
**Timestamp:** 2026-02-21 14:48:46
```
task_id: ses_37f8af2bdffe20Q39PsjAgicuc (for resuming to continue this task if needed)
<task_result>
Here is a concise summary of the project:
---
## Project: org-garden
### What it does
**org-garden** is an **org-roam to website publishing pipeline**. It converts a directory of Emacs Org-mode notes (written in `org-roam` format) into a fully rendered static website. The pipeline has four phases:
1. **Export**: Converts `.org` files to Markdown via `emacs --batch` + the `ox-hugo` Emacs package.
2. **Transform**: Runs Markdown post-processing transforms (e.g., resolving citation references via Zotero or a `.bib` file).
3. **Index generation**: Auto-generates an `index.md` if none was exported.
4. **Site build/serve**: Passes the Markdown output to [Quartz 4](https://quartz.jzhao.xyz/) (a static site generator) for rendering to HTML, with optional live-reload dev server.
The sample `content/` and `notes/` directories show notes about Madrid public transport (Metro, EMT buses, M-30, CRTM), indicating it's a personal knowledge garden site.
---
### Tech Stack
| Layer | Technology |
|---|---|
| Core pipeline | **Elixir** (OTP app, compiled as an escript binary) |
| Org export | **Emacs** (headless/batch) + **ox-hugo** package |
| Site rendering | **Quartz 4** (TypeScript/Node.js static site generator) |
| File watching | `file_system` Hex package (inotify on Linux) |
| HTTP client (citations) | `req` + `finch` (for Zotero Better BibTeX API) |
| JSON | `jason` |
| Package/build management | **Mix** (Elixir) + **npm** (Quartz) |
| Nix packaging | **flake.nix** — reproducible builds via NixOS/nixpkgs |
---
### Key Files
| File | Purpose |
|---|---|
| `mix.exs` | Elixir project definition, dependencies, escript config |
| `mix.lock` | Locked Hex dependency versions |
| `flake.nix` | Nix flake — builds the full app including Emacs+ox-hugo, Quartz (patched), and the Elixir escript |
| `lib/org_garden.ex` | Main module and public API |
| `lib/org_garden/cli.ex` | CLI entry point — `serve`, `build`, `export` commands with all flags |
| `lib/org_garden/export.ex` | Emacs/ox-hugo invocation logic |
| `lib/org_garden/watcher.ex` | Debounced file watcher for incremental rebuild |
| `lib/org_garden/transforms/citations.ex` | Citation transform (Zotero/BibTeX) |
| `quartz-config/quartz.config.ts` | Quartz site configuration (theme, plugins, etc.) |
| `patches/` | 4 patches applied to upstream Quartz source |
| `notes/` | Source `.org` files (bus/, metro/, roads/) |
| `content/` | Output Markdown (generated; checked-in as examples) |
---
### Commands to Build and Run
#### With Nix (recommended — handles all dependencies automatically)
```bash
# Enter the dev shell (Elixir, Node.js, Emacs+ox-hugo, inotify-tools)
nix develop
# Run the full application (serve mode) from the Nix flake
nix run . -- serve <notes-dir>
# Build a static site (one-shot, for CI/production)
nix run . -- build <notes-dir>
# Export only (org → markdown, no Quartz)
nix run . -- export <notes-dir>
# Build just the Elixir escript binary
nix build .#escript
# Build the patched Quartz source
nix build .#quartz-patched
```
#### With Mix (Elixir only, manual dependency management)
```bash
# Install Elixir dependencies
mix deps.get
# Compile
mix compile
# Build the escript binary
mix escript.build
# Run commands (requires QUARTZ_PATH env var for serve/build)
./org_garden serve <notes-dir> [--port 8080] [--ws-port 3001]
./org_garden build <notes-dir> [--output <path>]
./org_garden export <notes-dir> [--watch]
```
#### CLI Reference
```
org-garden serve <notes-dir> [--port 8080] [--ws-port 3001] # dev server + live reload
org-garden build <notes-dir> [--output <path>] # production static build
org-garden export <notes-dir> [--watch] # org→md only, optional watch
```
#### Environment Variables
| Variable | Default | Description |
|---|---|---|
| `NOTES_DIR` | (required positional) | Path to `.org` notes directory |
| `OUTPUT_DIR` | current working dir | Base output directory |
| `QUARTZ_PATH` | (required for serve/build) | Path to Quartz install with `node_modules` |
| `NODE_PATH` | `node` | Node.js executable |
| `BIBTEX_FILE` | none | Path to `.bib` fallback citation file |
| `ZOTERO_URL` | `http://localhost:23119` | Zotero Better BibTeX base URL |
| `CITATION_MODE` | `warn` | `silent` \| `warn` \| `strict` |
</task_result>
```
### Tool Call [completed]: write
**Tool:** edit
**Timestamp:** 2026-02-21 14:48:53
```
Wrote file successfully.
╭─────────╮
│ changes │
╰─────────╯
@@ -0,0 +1,28 @@
+#+title: org-garden
+
+An [[https://orgmode.org/][org-roam]] to static website publishing pipeline. Converts =.org= notes into a rendered site using Emacs/[[https://ox-hugo.scripter.co/][ox-hugo]] for export and [[https://quartz.jzhao.xyz/][Quartz 4]] for site generation.
+
+* Usage
+
+#+begin_example
+org-garden serve <notes-dir> # dev server with live reload
+org-garden build <notes-dir> # production static build
+org-garden export <notes-dir> # org → markdown only
+#+end_example
+
+* Running with Nix (recommended)
+
+#+begin_src sh
+nix run . -- serve <notes-dir>
+nix run . -- build <notes-dir>
+#+end_src
+
+* Running with Mix
+
+#+begin_src sh
+mix deps.get
+mix escript.build
+./org_garden serve <notes-dir>
+#+end_src
+
+Requires =QUARTZ_PATH= to point to a Quartz install with =node_modules= for =serve= and =build= commands.
```
## Agent (2026-02-21 14:48:55)
Created `README.org` with a brief overview of the project, the three CLI commands, and how to run it via Nix or Mix.
## User (2026-02-21 14:50:45)
Add this remote, commit and push: gitea@gitea.bueso.eu:ignacio.ballesteros/org-garden.git
### Tool Call [completed]: git init && git remote add origin gitea@gitea.bueso.eu:ignacio.ballesteros/org-garden.git
**Tool:** execute
**Timestamp:** 2026-02-21 14:50:47
```
Initialized empty Git repository in /home/ignaciobll/code/org-garden/.git/
```
### Tool Call [completed]: git remote add origin gitea@gitea.bueso.eu:ignacio.ballesteros/org-garden.git
**Tool:** execute
**Timestamp:** 2026-02-21 14:50:49
```
error: remote origin already exists.
```
### Tool Call [completed]: git status
**Tool:** execute
**Timestamp:** 2026-02-21 14:50:50
```
On branch main
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
.agent-shell/
README.org
content/
flake.lock
flake.nix
lib/
mix.exs
mix.lock
patches/
quartz-config/
static/
nothing added to commit but untracked files present (use "git add" to track)
```