add publish infrastructure and update docs for public release

- publish/manifest: explicit file allowlist for public repo
- publish/CLAUDE.md: sanitized version (no personal data paths)
- publish/extract_config.example.yaml: generic paths and owner
- publish.sh: orphan-branch publish script (single squashed commit)
- site/.env.example: documents BINCIO_DATA_DIR and PUBLIC_EDIT_URL
- README.md: updated pipeline diagram, quick start, project layout
- CHEATSHEET.md: added bincio render and bincio edit sections,
  sidecar format reference, updated daily workflow
This commit is contained in:
Davide Scaini
2026-03-29 16:07:06 +02:00
parent 547105550b
commit 6fa7e2bea3
7 changed files with 460 additions and 23 deletions
+49 -15
View File
@@ -6,8 +6,8 @@
# 1. Drop new .fit / .gpx / .tcx files into your input dir, then:
bincio extract
# 2. Rebuild the site
cd site && npm run build
# 2. Rebuild the site (merges any sidecar edits, then builds)
bincio render
# 3. Done — copy site/dist/ to your host
```
@@ -29,24 +29,53 @@ To force a full re-extract: `rm -rf ~/bincio_data && bincio extract`
---
## Site
## Render
```bash
bincio render # merge edits + production build → site/dist/
bincio render --serve # merge edits + dev server → http://localhost:4321
bincio render --data-dir ~/bincio_data # explicit data dir
```
`bincio render` always runs `merge_all()` first (applies sidecar edits, produces `_merged/`),
then symlinks `site/public/data``_merged/` and runs the Astro build or dev server.
```bash
# Direct npm (skips merge step — use for quick site-only iteration)
cd site
# Symlink data (do once)
ln -sf ~/bincio_data public/data
# Dev server with hot reload
npm run dev # → http://localhost:4321
# Production build
npm run build # → site/dist/
# Preview production build locally
npm run dev
npm run build
npm run preview
```
## Edit
```bash
# Start the edit server (port 4041 by default)
bincio edit --data-dir ~/bincio_data
# Set PUBLIC_EDIT_URL=http://localhost:4041 in site/.env to enable the Edit button
# Then browse to any activity and click Edit — a drawer opens in the same page
```
Saves write a sidecar `.md` to `~/bincio_data/edits/{id}.md` and immediately
trigger a merge. Refresh the page to see the updated content.
### Sidecar format
```markdown
---
title: "Renamed title"
sport: cycling
gear: "Trek Domane"
highlight: true # sort to top of feed
private: false # true = hidden from feed
hide_stats: [cadence] # suppress stat panels
---
Description in **markdown**. Images go in the gallery — drag & drop in the Edit drawer.
```
---
## Python / tests
@@ -128,7 +157,9 @@ Mapping lives in `bincio/extract/sport.py`.
## Patching activities (manual fixes)
When re-running extract isn't practical, patch the JSON directly:
Prefer the Edit drawer for title/sport/description/photo changes — it writes a sidecar
and keeps extracted data pristine. For bulk fixes or fields not exposed in the UI,
patch the JSON directly:
```bash
# Fix sport for a single activity
@@ -194,8 +225,11 @@ print(len(others), 'total')
| File | Purpose |
|---|---|
| `extract_config.yaml` | Main config (input dirs, output dir, privacy) |
| `site/.env` | Site env vars (`BINCIO_DATA_DIR`, `PUBLIC_EDIT_URL`) — copy from `.env.example` |
| `SCHEMA.md` | BAS format specification |
| `CLAUDE.md` | Dev notes, gotchas, design decisions |
| `bincio/render/merge.py` | Sidecar overlay logic — `parse_sidecar`, `merge_all` |
| `bincio/edit/server.py` | FastAPI edit API — GET/POST activity, image upload |
| `bincio/extract/sport.py` | Sport name normalisation + mapping |
| `bincio/extract/metrics.py` | Distance, speed, HR, elevation computation |
| `bincio/extract/parsers/fit.py` | FIT file parser |