This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Diceware passphrase generator — a single-page static web app that generates cryptographically secure passphrases using the browser's crypto.getRandomValues() CSPRNG. Hosted at https://diceware.rempe.us.
Development tools are managed by mise and defined in .tool-versions. Install all dependencies with:
mise installThis provides Node.js, Deno, Caddy, and Task.
No build step. Serve the directory with:
task serveThen open http://localhost:8080. A local HTTP server is required (ES modules don't work over file://).
All tasks are defined in Taskfile.yml. Run task to list them.
task serve— start local dev server on http://localhost:8080task lint— check linting and formattingtask lint-fix— auto-fix lint and format issuestask format— format all filestask verify— run all verification tiers, update list metadata and generate reportstask verify -- lists/eff.js— verify a specific list file (with writes)task verify-check— quick read-only verification (tiers 1+2, no writes)task precommit— run all precommit checks (lint + full verification)task install— install npm dependencies (runs automatically as a dependency of lint tasks)task docker-build— build Docker image locallytask docker-run— build and run Docker container on http://localhost:8080
Zero runtime dependencies. The only external CSS is Pico CSS v2 (vendored locally). All JavaScript is vanilla ES modules.
js/main.js— Entry point. Application state, event listeners, initializationjs/crypto.js—secureRandom()CSPRNG using rejection samplingjs/entropy.js— Entropy calculation, crack time math (nativeBigInt), attacker tier definitionsjs/wordlist.js— Word lookup via registry, list state managementjs/ui.js— DOM updates, clipboard (navigator.clipboard), crack time display
lists/registry.js— Lazy-loading registry mapping list IDs to word maps via dynamicimport(); only the default EFF list and special characters are loaded eagerlylists/*.js— ES modules exportingconstobjects with 7776 entries keyed by 5-digit die rollslists/special.js— 36 special characters keyed by 2-digit die rolls
index.html— Semantic HTML with Pico CSS classless stylingfaq.html— FAQ page with<details>-style sectionscss/pico.classless.min.css— Vendored Pico CSS v2 (do not edit)css/app.css— Minimal custom styles on top of Pico
- No server communication — everything runs client-side with no analytics or logging
- Zero runtime dependencies — all JS is vanilla, CSS is vendored Pico only
- Auditable — users can clone and inspect all code for trust
- Offline-capable — works without network after initial load
- Lazy-loaded word lists — only the default EFF list loads eagerly; others load on demand via dynamic
import() - URL hash — reflects active word list, supports direct linking
Both index.html and faq.html contain SEO metadata that must be kept in sync with content changes:
sitemap.xml— Update<lastmod>dates when pages changerobots.txt— Points crawlers to the sitemap- Open Graph / Twitter Card tags — In
<head>of both pages. Updateog:title,og:description, andtwitter:*tags if the page title or description changes - JSON-LD structured data —
index.htmlhas aWebApplicationschema;faq.htmlhas aFAQPageschema. When adding, removing, or editing FAQ entries, update the correspondingQuestion/Answerpair in theFAQPageJSON-LD block at the bottom offaq.html - Canonical URLs — Each page has
<link rel="canonical">. Update if page URLs change
The app is containerized using Caddy on Alpine Linux. GitHub Actions builds and publishes multi-platform images (amd64 + arm64) to ghcr.io/grempe/diceware on every push to main or v* tag.
Dockerfile— Based oncaddy:2-alpine, copies only production static assets into/srvCaddyfile.production— Production Caddy config (separate from devCaddyfile): compression, security headers, cache rules, admin API disableddocker-compose.yml— Local development: builds and runs on port 8080 with healthcheck.github/workflows/docker-publish.yml— CI/CD: multi-arch build, ghcr.io publish, SLSA provenance attestation.dockerignore— Excludes dev tooling, VCS dirs, and documentation from the build context
When modifying served content (HTML, CSS, JS, word lists, reports), ensure the Dockerfile COPY directives still cover the new files.
- Linting and formatting via Biome — run
task lintto check,task lint-fixto auto-fix - 2-space indent, single quotes, semicolons as needed