This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
interscript.org v2 — the Interscript website, rebuilt on Astro 7 (branch astro-migration). It replaces the legacy react-static site that still lives on the main branch — consult main (and TODO.complete/) as the reference for feature parity. Content claims must be factual: do not fabricate partner/authority/endorsement statements.
npm run dev # dev server (localhost:4321; bumps port if taken — e2e uses 4322)
npm run build # static build to dist/
npm run preview # serve the build
npm run check # astro check (TypeScript across .astro/.ts/.vue)
npm test # vitest run (unit tests in test/)
npx vitest run test/site.test.ts # single test file
npm run test:e2e # Playwright (e2e/); local runs need `npm run dev` on 4322
npm run lint # eslint
npm run format # prettier --write .
npm run generate:catalogue # regenerate src/data/maps-catalogue.json from .isc sourcesDependency note: interscript-ts is a file: dependency on the sibling checkout ../interscript-ts, and npm run generate:catalogue reads ../maps/maps/*.isc — both sibling repos must exist locally.
- Rendering: Astro
output: "static"+@astrojs/nodeadapter. Pages undersrc/pages/are prerendered by default; the real-time routes (src/pages/api/{detect,systems,transliterate,transliterate/batch}.ts) opt out withexport const prerender = falseand runinterscript-tsserver-side. - Interactive islands: Vue 3 (
@astrojs/vue) for tools —MapExplorer,CompareMode,BatchProcessor,DiffViewer,DetectPanel,MarcTool,SubtitlesProcessor, etc. Static pages are plain.astroimporting these islands. - Map data: ~289 compact
.iscmaps inpublic/maps/. The browsable cataloguesrc/data/maps-catalogue.jsonis generated byscripts/generate-catalogue.mjs(commit the regenerated file when maps change). - Map loading strategies (why two modules): browser runtimes use
src/scripts/map-strategies.ts— ISC files first, compiled-JSON HTTP fallback only for.imllibraries (posix, unicode, var-Cyrl, var-kor) which have no ISC form. The SSR API routes usesrc/lib/server-map-strategies.ts— same order but ISC loads from the filesystem, no HTTP roundtrip. Keep both in sync. - Transliteration worker:
src/scripts/transliteration-worker.tsruns interscript-ts off the main thread;worker-client.tsis the typed RPC client. Vite bundles the worker vianew Worker(new URL(...), { type: "module" }). - Design system: single source of truth in
src/styles/global.css— Tailwind 4 CSS-first@themetokens (colors, fonts, type scale, spacing) plus component classes (.btn,.card,.prose,.eyebrow). All pages consume these tokens; don't hardcode hex values.src/layouts/Base.astroowns the header nav / drawer / footer and carries its scoped styles inline. - Content: AsciiDoc (
src/content/docs/,src/content/blog/) loaded bysrc/content/loaders/asciidoc.ts(manual frontmatter parse + @asciidoctor/core), rendered into.prosewrappers. - Theme: light/dark via
data-themeon<html>; tokens flip insrc/styles/global.css. A service worker (public/sw.js) provides offline access.
test/*.test.ts— vitest + happy-dom; covers pages, components, catalogue integrity, API endpoints.e2e/*.spec.ts— Playwright, Chromium only. In CI the config startsnpm run devitself; locally run the dev server on port 4322 first (configbaseURL).
- Conventional Commits (
feat:,fix:,docs:, …). All changes go through PRs tomain(branchastro-migrationis the active migration branch). - Lint:
eslint.config.mjs(ESLint 10 flat config; TS + Astro + Vue). Prettier:.prettierrc(no semicolons, 100 cols, astro plugin),.prettierignorefor generated/legacy paths. - Astro whitespace trap: Astro trims the space at a text↔inline-tag line break —
Backed by\n<code>renders asbyinterscript-ts.prettier-plugin-astroreflows prose and will create such breaks;test/site.test.tshas a guard that fails on them.prettier-ignorecomments corrupt.astrofiles — instead, hand-wrap the paragraph at text-only boundaries and add the file to.prettierignore(seesrc/pages/compare.astro).