Files
CatoandClaude 083dd52f0d feat(engine): courses in data, pack-declared forms, level sources, and meanings in the learner's language (#355)
* feat(course): every stored record names its course, and today's progress is the Zurich course's

A course registry (lib/course/registry.ts) lists the one course there is;
lib/variety/active.ts resolves its pack. Browser stores that hold course
progress move to an envelope keyed by course under .v2 keys, and a value
under the old .v1 key is read as the default course without being rewritten.
progress_devices, certificates and entitlements gain a course column that
defaults to the Zurich course. Item ids are unique across courses, and the
default course's ids are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* refactor(variety): the pack declares its articles, persons, respellings, voices and prompt lines

Article, FormLabel and VocabularyGroup were closed unions of the Zurich
values, the answer comparison folded Zurich respellings for every language,
word distance lower-cased as German, the voice ranking named two German tags
and the prompt builder carried Swiss spelling advice. Each is now a field of
the pack, read by the engine; a contract test over every pack refuses a value
the pack did not declare, and the leak test also looks for the taught
language's own words in engine code. The Ukrainian pack gains one verb with
its own pronouns and no articles. The 2,956 published items and the system
prompt are byte-identical.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* refactor(practice): an item's level comes from a source the course chooses

A course entered from a sibling language measures each item's distance from
that language, exactly as before; a course entered from zero reads a declared
CEFR band on the word, the line or the topic. levels.ts exposes both as
LevelSource and picks by Course.entry. Every published item keeps its level.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* feat(meaning): a meaning can be shown in the learner's language

A meaning is the bridge form plus an optional gloss in the interface
language. One pure rule (lib/domain/meaning/meaning.ts) decides what is
printed from the learner's answer to «Wie gut ist dein Deutsch?»: good shows
German only, as before and by default; some shows German and the gloss; none
shows the gloss; without a gloss German is always shown. Every exercise, the
word list and the scene pages print meanings through one component. The
answer is a course store, set in the settings and asked once after the start
card, only in an interface language that has glosses. Gloss sets are one
file per course and language, loaded on demand.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* content(glosses): English and Russian meanings for every word and scene line; French and Italian for every word

Machine drafts from the Zurich form and its German meaning together, marked
unreviewed in the data. One file per language beside the pack, keyed by the
German the course gives. Tests refuse a key no entry carries, an empty gloss
and two glosses for one German form; pnpm run glosses:coverage prints what
is covered.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* content(glosses): French and Italian meanings for every scene line

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* docs: courses, pack-declared forms, level sources and glosses, as they now are

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* refactor(variety): the pack says which grammatical person each of its labels is

The gloss check and the prompt's auxiliary table, both new on main, matched
the Zurich labels «ich» and «er» by name. The forms pass of the leak test
caught it on rebase. The pack now declares personOf, and both read it; the
system prompt and the published items are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-25 14:17:35 +01:00

37 lines
1.9 KiB
TypeScript

import { COURSE, VARIETY } from "../../variety/active.ts";
import { SITUATIONS } from "../../situations/active.ts";
import { inCourse, packItems } from "./generate.ts";
import type { PracticeItem } from "./types.ts";
/**
* The questions the pack can ask, frozen at module load — and the ONLY thing
* about the pack that a practice page is allowed to see.
*
* WHY THIS MODULE EXISTS AT ALL.
*
* `display.ts` makes the same argument for the pack itself: a variety pack is
* authored in one language, some of its fields are English prose meant for
* whoever maintains it and for the model, and those fields reached readers
* three separate times before the rule became structural. The practice page
* needs the pack — it has to generate items from the rules, the grammar
* examples and the vocabulary — so it would have been the fourth.
*
* It does not need a projection of the PACK, though. It needs a projection of
* the QUESTIONS, which is what this is: `PracticeItem` carries only words of
* the variety, words of the bridge, closed keys the dictionaries render, and
* the source ids a page links with. No `reason`, no `cue`, no `note`. The
* prose-field walk in `display.test.ts` runs over this too, so an item kind
* that starts carrying an explanation fails the build rather than shipping
* English to a French reader.
*
* The learner's own words are deliberately absent. They live in the browser
* and are turned into items there; the server has none and this is what it
* means for it to have none.
*
* The situation packs come in here too, and this is the only place that knows
* about them: `generate.ts` stays pure and takes them as an argument, so a
* test can build a session out of two invented scenes without the deployment's
* own packs leaking into the assertion.
*/
export const PACK_ITEMS: readonly PracticeItem[] = inCourse(COURSE, packItems(VARIETY, SITUATIONS, COURSE.entry));