From 436646bb019ca9f0a063ae0b6fc06918bfc808f8 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Sat, 19 Sep 2026 21:47:30 +0200 Subject: [PATCH] ci: publish craft workshop prototype --- Jenkinsfile | 40 ++++++++++++++++++++++++++++++++++++++-- README.md | 7 +++++++ craft_web/README.md | 17 +++++++++++++++++ craft_web/TASKS.md | 41 ++++++++++++++++++++++++++++------------- 4 files changed, 90 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 423a719..257a585 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,8 +7,10 @@ pipeline { environment { UV_CACHE_DIR = "${WORKSPACE}/.uv-cache" BUILD_DIR = 'build' + CRAFT_BUILD_DIR = 'craft_web/build' DEPLOY_ROOT = '/mnt/books/RPG' SHEET_DIR = 'ravenous_sheet' + CRAFT_DIR = 'ravenous_craft' LEGACY_DEPLOY_DIR = '/mnt/books/ravenous_sheet' } @@ -82,9 +84,11 @@ pipeline { mkdir -p "${BUILD_DIR}" uv sync --frozen ./scripts/build.sh + uv run python craft_web/tools/build.py --output "${CRAFT_BUILD_DIR}" uv run python tools/export_monsters.py --id 2 --output "${BUILD_DIR}/example-monster-2.json" uv run python tools/export_monsters.py --id 5 --output "${BUILD_DIR}/example-monster-5.json" uv run python -m unittest discover -s tests -v + uv run python -m unittest discover -s craft_web/tests -v if command -v node >/dev/null 2>&1; then RAVENOUS_CHARACTER_JSON="${BUILD_DIR}/example-character.json" \ RAVENOUS_MONSTER_JSON="${BUILD_DIR}/example-monster-2.json" \ @@ -96,6 +100,7 @@ pipeline { echo 'Node is not installed on this agent; skipping the optional Roll20 Mod simulator tests.' fi ./scripts/build.sh --check + uv run python craft_web/tools/build.py --output "${CRAFT_BUILD_DIR}" --check test -f "${BUILD_DIR}/ravenous.html" test -f "${BUILD_DIR}/ravenous.css" @@ -107,9 +112,16 @@ pipeline { test -f "${BUILD_DIR}/example-craft-alchemy.json" test -f "${BUILD_DIR}/example-monster-2.json" test -f "${BUILD_DIR}/example-monster-5.json" + test -f "${CRAFT_BUILD_DIR}/index.html" + test -f "${CRAFT_BUILD_DIR}/styles.css" + test -f "${CRAFT_BUILD_DIR}/app.js" + test -f "${CRAFT_BUILD_DIR}/catalog.js" + test -f "${CRAFT_BUILD_DIR}/build-info.json" echo "Roll20 sheet build complete:" ls -lh "${BUILD_DIR}" + echo "Craft workshop build complete:" + ls -lh "${CRAFT_BUILD_DIR}" ''' } } @@ -117,7 +129,7 @@ pipeline { stage('Archive sheet') { steps { archiveArtifacts( - artifacts: 'build/**', + artifacts: 'build/**,craft_web/build/**', fingerprint: true ) } @@ -131,22 +143,27 @@ pipeline { def productionBranches = ['origin/main', 'main', 'origin/master', 'master'] def targetDir def legacyDir + def craftTargetDir if (reviewBranches.contains(env.BRANCH_NAME)) { targetDir = "${DEPLOY_ROOT}/${SHEET_DIR}_lighthouse" legacyDir = "${LEGACY_DEPLOY_DIR}_lighthouse" + craftTargetDir = "${DEPLOY_ROOT}/${CRAFT_DIR}_lighthouse" } else if (devBranches.contains(env.BRANCH_NAME)) { targetDir = "${DEPLOY_ROOT}/${SHEET_DIR}_candlelight" legacyDir = "${LEGACY_DEPLOY_DIR}_candlelight" + craftTargetDir = "${DEPLOY_ROOT}/${CRAFT_DIR}_candlelight" } else if (productionBranches.contains(env.BRANCH_NAME)) { targetDir = "${DEPLOY_ROOT}/${SHEET_DIR}" legacyDir = LEGACY_DEPLOY_DIR + craftTargetDir = "${DEPLOY_ROOT}/${CRAFT_DIR}" } else { echo "Branch '${env.BRANCH_NAME}' is not a publication branch — skipping deployment." return } deployTo(targetDir, legacyDir) + deployCraftTo(craftTargetDir) } } } @@ -158,7 +175,7 @@ pipeline { conclusion: 'SUCCESS', name: 'Roll20 Sheet Build Successful', summary: 'The Ravenous Roll20 sheet was generated and validated successfully.', - text: 'HTML, CSS, translations, manifest, and build metadata are available as Jenkins artifacts.', + text: 'The Roll20 bundle and static craft workshop are available as Jenkins artifacts.', title: 'Roll20 Sheet Build Successful' ) echo '✅ Ravenous Roll20 sheet built successfully!' @@ -188,6 +205,25 @@ pipeline { } } +/** Publish the static craft workshop below the shared RPG root. */ +def deployCraftTo(String targetDir) { + def allowedDirs = [ + '/mnt/books/RPG/ravenous_craft', + '/mnt/books/RPG/ravenous_craft_candlelight', + '/mnt/books/RPG/ravenous_craft_lighthouse' + ] + if (!allowedDirs.contains(targetDir)) { + error("Refusing to publish craft workshop to unexpected path: ${targetDir}") + } + + sh """ + set -e + echo "Publishing Ravenous craft workshop to ${targetDir}" + mkdir -p "${targetDir}" + rsync -a --delete "${env.CRAFT_BUILD_DIR}/" "${targetDir}/" + """ +} + /** Publish under the shared RPG root, then remove this branch's legacy location. */ def deployTo(String targetDir, String legacyDir) { diff --git a/README.md b/README.md index acaf431..5b11f02 100644 --- a/README.md +++ b/README.md @@ -326,6 +326,13 @@ l'ancien dossier `/mnt/books/ravenous_sheet`. Les branches `candlelight` et `_lighthouse`, et retirent de la même façon leur ancien dossier suffixé. Les autres branches sont construites et archivées sans être déployées. +Le pipeline construit également la preuve de concept de l'atelier d'artisanat +statique depuis `craft_web/`. Elle est publiée dans +`/mnt/books/RPG/ravenous_craft`, soit +`https://books.dandaedre.com/RPG/ravenous_craft/`, avec les suffixes +`_candlelight` et `_lighthouse`. Le site ne requiert ni Node.js ni serveur +applicatif : Python génère ses fichiers HTML, CSS, JavaScript et son catalogue. + ## Notes Roll20 Dans une partie utilisant une feuille personnalisée, copiez le contenu des diff --git a/craft_web/README.md b/craft_web/README.md index cb1425b..a752113 100644 --- a/craft_web/README.md +++ b/craft_web/README.md @@ -17,6 +17,23 @@ The intended implementation is deliberately boring to deploy: The product scope and implementation phases are in [TASKS.md](TASKS.md). The authoritative development rules and source map are in [AGENTS.md](AGENTS.md). +## Current proof of concept + +The first deployable prototype includes the complete generated catalogue, all +book themes, responsive filtering and sorting, a component workspace with basic +totals, browser-local saving, and a provisional Roll20 export. It demonstrates +the intended information architecture and visual direction; discipline-specific +rules and authoritative final-output mapping remain tracked in `TASKS.md`. + +```sh +uv run python craft_web/tools/build.py +uv run python -m unittest discover -s craft_web/tests -v +uv run python craft_web/tools/build.py --check +``` + +Jenkins publishes production at `/RPG/ravenous_craft/`, with `_candlelight` +and `_lighthouse` siblings for development and review branches. + ## Proposed user experience The home screen is a searchable catalog and recipe workspace. A player chooses diff --git a/craft_web/TASKS.md b/craft_web/TASKS.md index 44bd064..6fe0b73 100644 --- a/craft_web/TASKS.md +++ b/craft_web/TASKS.md @@ -3,26 +3,41 @@ This backlog is intentionally staged. Phase 0 decisions should be approved before implementation because they affect saved data, URLs, and deployment. +## Functional proof of concept + +- [x] Build a deterministic static site with Python only and no runtime CDN. +- [x] Display 511 live entries from every craft TSV and the Forge SQLite table. +- [x] Provide all Typst-derived themes, responsive catalogue cards, text search, + discipline/stage filters, numeric limits, and sorting. +- [x] Let players add/remove components and display live tier, cost, difficulty, + toxicity, artisan level, and a simple difficulty warning. +- [x] Demonstrate local browser saving and a provisional Roll20 JSON download. +- [x] Add deterministic Python tests and a `--check` build mode. +- [x] Build, archive, and deploy the prototype through Jenkins below `RPG/`. + +The proof of concept intentionally does not claim full rule parity yet. The +remaining phases turn it into a trusted calculator and production application. + ## Phase 0 — Decisions to vet - [ ] Approve the two-format model: editable `ravenous-workshop-recipe` files for reopening and sharing, finalized `ravenous-roll20-craft` v1 files for Roll20 import. -- [ ] Approve all five initial disciplines: Forge, Restauration, Alchimie, +- [x] Approve all five initial disciplines: Forge, Restauration, Alchimie, Brasserie, and Pièges. Alternatively, select an MVP subset; recommended MVP is Alchimie + Restauration, followed by Brasserie, Forge, then Pièges. - [ ] Decide whether invalid/excess recipes may be saved and shared with clear warnings. Recommendation: yes, but block finalized Roll20 export until hard structural errors are fixed; artisan-limit overruns remain exportable only after an explicit acknowledgement because a GM may authorize them. -- [ ] Confirm French-only v1. Recommendation: generate stable internal IDs now, +- [x] Confirm French-only v1. Recommendation: generate stable internal IDs now, but defer UI localization until the French workflow is complete. -- [ ] Approve browser-local storage with explicit JSON backup/restore and no +- [x] Approve browser-local storage with explicit JSON backup/restore and no server synchronization or analytics. - [ ] Approve QR contents and limits: encode compact editable recipes, show the approximate QR size, and fall back to download/share text above the tested capacity. Camera scanning is a later enhancement, not MVP. -- [ ] Pick the public path. Recommendation: +- [x] Pick the public path. Recommendation: `/mnt/books/RPG/ravenous_craft/` (`/RPG/ravenous_craft/`) as a sibling of the Roll20 sheet, with branch suffixes matching the existing deployment policy. - [ ] Approve a vendored, license-recorded QR encoder with no CDN/runtime @@ -30,15 +45,15 @@ before implementation because they affect saved data, URLs, and deployment. ## Phase 1 — Data compiler and executable model -- [ ] Scaffold the documented `craft_web/src`, `tools`, `tests`, `schemas`, and +- [x] Scaffold the documented `craft_web/src`, `tools`, `tests`, `schemas`, and generated `build` layout; add the build directory to `.gitignore`. - [ ] Extract a shared Typst text translator so the sheet, monster exporter, and craft catalog use identical glossary labels and star rendering. -- [ ] Parse every craft TSV into a normalized, versioned catalog with stable +- [x] Parse every craft TSV into a normalized, versioned catalog with stable IDs, typed values, source provenance, compatibility tags, and rendered text. -- [ ] Read Forge equipment from `data/src/db/weapons.db` and normalize nullable, +- [x] Read Forge equipment from `data/src/db/weapons.db` and normalize nullable, numeric, categorical, special-effect, and application-target fields. -- [ ] Generate all available palettes from `setup/theme/themes.typ` into CSS +- [x] Generate all available palettes from `setup/theme/themes.typ` into CSS variables plus theme metadata; define a safe default and high-contrast mode. - [ ] Port the aggregation semantics from `setup/craft_recipes.typ` into a pure Python reference model for all five disciplines. @@ -49,14 +64,14 @@ before implementation because they affect saved data, URLs, and deployment. - [ ] Turn curated `data/config/recipes.yaml` entries into golden fixtures and add boundary tests for negative totals, repeated effects, finishing budgets, brewery titrage, forge reductions, and trap timing. -- [ ] Emit deterministic `catalog.json`, schema files, build metadata, and a +- [ ] Emit deterministic catalog assets, schema files, build metadata, and a human-readable unsupported-markup report; add `--check`. ## Phase 2 — Read-only catalog browser -- [ ] Build the semantic application shell with responsive navigation for the +- [x] Build the semantic application shell with responsive navigation for the five disciplines and a useful no-JavaScript explanation. -- [ ] Implement accent-insensitive full-text search over name, stage, detail, +- [x] Implement accent-insensitive full-text search over name, stage, detail, and rendered effects. - [ ] Implement combinable filters: tier/mastery, cost, difficulty, toxicity, stage/category, satiety, finishing, titrage, time, equipment target, and trap @@ -132,9 +147,9 @@ before implementation because they affect saved data, URLs, and deployment. locality, and forbidden CDN/Node dependencies. - [ ] Add an optional browser smoke-test strategy that works on FreeBSD 13 or document manual browser coverage; do not make Node a hidden requirement. -- [ ] Extend Jenkins with separate build, test, archive, and guarded deployment +- [x] Extend Jenkins with separate build, test, archive, and guarded deployment steps for the craft site, preserving the existing Roll20 sheet artifacts. -- [ ] Publish review/development/production branches under the approved sibling +- [x] Publish review/development/production branches under the approved sibling paths below `/mnt/books/RPG/`, with an explicit deployment allow-list. - [ ] Perform manual acceptance in current Firefox and Chromium on desktop and mobile-sized viewports: compose each discipline, reload offline, save/restore,