How goblindegook/musarrif works
Purpose and runtime entry points
Muṣarrif is an offline-capable Arabic verb conjugator and recognition-drill PWA, with a Tauri 2 desktop wrapper. The browser UI starts at src/ui/main.tsx, composes application routing/state in src/ui/app.tsx, and is built from index.html through Vite. Desktop startup is Rust/Tauri at src-tauri/src/main.rs, configured by src-tauri/tauri.conf.json.
Lexicon and localization boundary
The curated lexical source is src/data/roots.json: roots, verb forms, vowel patterns, voice/nominal support, and related metadata. Human-facing root and verb labels are separate locale datasets in src/ui/locales/en.verbs.json, src/ui/locales/it.verbs.json, and src/ui/locales/pt.verbs.json. This separation lets deterministic grammar operate on transliterated lexical metadata while the UI renders localized text.
Conjugation engine
Pure TypeScript paradigm modules transform a selected root/verb plus grammatical dimensions into conjugated Arabic forms and explanatory annotations. Key orchestration and domain boundaries are src/paradigms/conjugation.ts, src/paradigms/verbs.ts, and src/paradigms/roots.ts; tense/voice implementations are partitioned under src/paradigms/active/, src/paradigms/passive/, and src/paradigms/nominal/. Search resolves user input into roots and verbs through src/paradigms/search.ts.
Reference-mode flow
Users navigate to lookup/conjugation views through src/ui/routes.ts and src/ui/pages/ConjugationMode.tsx. src/ui/organisms/ConjugateBox.tsx collects search and grammatical selections, invokes the paradigm/search layer, and presents output via src/ui/organisms/ConjugationTable.tsx plus insight panels. The UI is therefore a consumer of grammar-domain results, rather than embedding morphology rules.
Exercise and SRS flow
Exercise mode is coordinated in src/ui/pages/ExerciseMode.tsx. src/exercises/exercises.ts selects exercise types; focused generators in src/exercises/generators/ create prompts, answers, and distractors from paradigm data. Answer outcomes feed scheduling and progress logic in src/exercises/srs.ts, src/exercises/scheduler.ts, and src/exercises/mastery.ts. This isolates learning policy from both UI rendering and conjugation rules.
Client persistence and device capabilities
Browser-facing hooks maintain local user state—SRS data, settings/dimensions, favorites, recents, and stats—behind src/ui/hooks/useSrsStore.ts, src/ui/hooks/useDimensionStore.ts, and src/ui/user-data.ts. Speech and speech recognition are optional browser capabilities via src/ui/hooks/useSpeech.ts and src/ui/hooks/useSpeechRecognition.ts. Optical transfer components (src/ui/organisms/OpticalSend.tsx, src/ui/organisms/OpticalReceive.tsx) support local data exchange without a backend.
External systems and maintenance pipeline
The deployed web target is a static Vite PWA; no application server or database is represented. Tauri supplies the desktop host. Node/TypeScript scripts maintain lexicon and validate external references: scripts/verb.mts edits lexical/localization data, while scripts/lib/elixirfm.mts, scripts/lib/reverso.mts, and scripts/lib/wiktionary.mts fetch external conjugation sources to generate regression expectations. CI is defined in .github/workflows/ci.yml.
Main entry points: conjugation.ts Conjugation orchestration · ExerciseMode.tsx Exercise mode · app.tsx Application shell · routes.ts Routes
Components 21
Browser UI
- Vite PWA build · Builds the browser application from the HTML entry point.
index.html - UI entry
src/ui/main.tsx - Application shell
src/ui/app.tsx - Routes
src/ui/routes.ts - Reference mode
src/ui/pages/ConjugationMode.tsx - Conjugation controls · Collects lookup and grammatical selections.
src/ui/organisms/ConjugateBox.tsx - Conjugation output
src/ui/organisms/ConjugationTable.tsx - Local user state · Stores SRS, dimensions, favorites, recents, and stats locally.
src/ui/user-data.ts
Grammar domain
- Conjugation orchestration · Computes forms and explanatory annotations from lexical and grammatical input.
src/paradigms/conjugation.ts - Verb and root domain
src/paradigms/verbs.ts - Tense and voice paradigms · Active, passive, and nominal transformations.
- Lexicon search
src/paradigms/search.ts
Exercises & SRS
- Exercise mode
src/ui/pages/ExerciseMode.tsx - Exercise generation · Selects exercise types and creates prompts, answers, and distractors.
- Exercise selection
src/exercises/exercises.ts - SRS & mastery · Schedules reviews and calculates learner progress.
src/exercises/srs.ts
Lexicon & locales
- Curated roots lexicon · Transliterated roots, forms, patterns, and grammatical metadata.
src/data/roots.json - Localized verb labels · English, Italian, and Portuguese display labels.
src/ui/locales/en.verbs.json
Desktop & maintenance
- Tauri desktop host
src-tauri/src/main.rs - Lexicon maintenance · Edits lexical data and validates external conjugation references.
scripts/verb.mts - CI
.github/workflows/ci.yml
Connections 24
- Vite PWA build → UI entry: loads
- UI entry → Application shell: mounts
- Application shell → Routes: uses
- Routes → Reference mode: navigates to
- Routes → Exercise mode: navigates to
- Reference mode → Conjugation controls: contains
- Conjugation controls → Lexicon search: resolves input
- Conjugation controls → Conjugation orchestration: requests forms
- Conjugation orchestration → Conjugation output: returns results to
- Lexicon search → Verb and root domain: queries
- Conjugation orchestration → Verb and root domain: uses
- Conjugation orchestration → Tense and voice paradigms: dispatches to
- Verb and root domain → Curated roots lexicon: reads
- Application shell → Localized verb labels: renders
- Exercise mode → Exercise selection: coordinates
- Exercise selection → Exercise generation: selects
- Exercise generation → Conjugation orchestration: derives answers from
- Exercise mode → SRS & mastery: records outcomes
- SRS & mastery → Local user state: persists progress
- Exercise mode → Local user state: reads learner state
- Tauri desktop host → Vite PWA build: hosts built UI
- Lexicon maintenance → Curated roots lexicon: edits and validates
- Lexicon maintenance → Localized verb labels: edits
- CI → Lexicon maintenance: runs validation