Add script to create promotional booklet video assets
Browse filesThis commit introduces a new Python script, `make_book.py`, which generates the cover and pages for a promotional booklet video. The script processes a cover photo by straightening it and applying a white overlay to a stage line, and it extracts pages from a provided PDF using the `pdftoppm` utility. The output includes a JPEG cover and individual page images, facilitating the creation of a video showcasing the booklet.
- .agents/skills/.openspec-target +1 -0
- .agents/skills/openspec-apply-change/SKILL.md +206 -0
- .agents/skills/openspec-archive-change/SKILL.md +221 -0
- .agents/skills/openspec-explore/SKILL.md +356 -0
- .agents/skills/openspec-propose/SKILL.md +175 -0
- .agents/skills/openspec-sync-specs/SKILL.md +290 -0
- .agents/skills/openspec-update-change/SKILL.md +109 -0
- .gitattributes +1 -0
- .nvmrc +1 -0
- README.md +2 -2
- app/phrases.py +1 -1
- app/rules.py +14 -0
- app/workbook.py +1 -1
- openspec/changes/archive/.gitkeep +0 -0
- openspec/config.yaml +34 -0
- openspec/specs/.gitkeep +0 -0
- openspec/specs/access-and-privacy/spec.md +47 -0
- openspec/specs/learning-activities/spec.md +59 -0
- openspec/specs/progress-and-practice/spec.md +52 -0
- openspec/specs/pronunciation-practice/spec.md +51 -0
- openspec/specs/quality-and-calibration/spec.md +36 -0
- openspec/specs/teacher-content/spec.md +43 -0
- scripts/demo_video/README.md +13 -4
- scripts/demo_video/assets/cover.jpg +3 -0
- scripts/demo_video/assets/p53.jpg +3 -0
- scripts/demo_video/assets/p54.jpg +3 -0
- scripts/demo_video/assets/p55.jpg +3 -0
- scripts/demo_video/assets/p56.jpg +3 -0
- scripts/demo_video/assets/p57.jpg +3 -0
- scripts/demo_video/assets/p58.jpg +3 -0
- scripts/demo_video/assets/p59.jpg +3 -0
- scripts/demo_video/assets/p60.jpg +3 -0
- scripts/demo_video/assets/p61.jpg +3 -0
- scripts/demo_video/make_book.py +46 -0
- scripts/demo_video/promo.html +176 -25
- scripts/demo_video/promo.py +61 -16
- static/assets/pronunciation-rules.md +1 -0
- static/index.html +169 -39
- static/trace.html +1 -1
- tests/test_scoring.py +22 -0
.agents/skills/.openspec-target
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
codex
|
.agents/skills/openspec-apply-change/SKILL.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: openspec-apply-change
|
| 3 |
+
description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks. Also use when the user says "openspec apply", "opsx apply", or "openspec implement".
|
| 4 |
+
allowed-tools: Bash(openspec:*)
|
| 5 |
+
license: MIT
|
| 6 |
+
compatibility: Requires openspec CLI.
|
| 7 |
+
metadata:
|
| 8 |
+
author: openspec
|
| 9 |
+
version: "1.0"
|
| 10 |
+
generatedBy: "1.14.3"
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
Implement tasks from an OpenSpec change.
|
| 14 |
+
|
| 15 |
+
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
| 16 |
+
|
| 17 |
+
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
| 18 |
+
|
| 19 |
+
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
| 20 |
+
|
| 21 |
+
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
| 22 |
+
|
| 23 |
+
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
| 24 |
+
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
| 25 |
+
|
| 26 |
+
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
| 27 |
+
|
| 28 |
+
**Input**: Optionally specify a change name (e.g., `$openspec-apply-change (Codex) or /openspec-apply-change (other agents) add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
| 29 |
+
|
| 30 |
+
**Steps**
|
| 31 |
+
|
| 32 |
+
1. **Select the change**
|
| 33 |
+
|
| 34 |
+
If a name is provided, use it. Otherwise:
|
| 35 |
+
- Infer from conversation context if the user mentioned a change
|
| 36 |
+
- Auto-select if only one active change exists
|
| 37 |
+
- If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
|
| 38 |
+
|
| 39 |
+
Always announce: "Using change: <name>" and how to override (e.g., `$openspec-apply-change (Codex) or /openspec-apply-change (other agents) <other>`).
|
| 40 |
+
|
| 41 |
+
2. **Check status to understand the schema**
|
| 42 |
+
```bash
|
| 43 |
+
openspec status --change "<name>" --json
|
| 44 |
+
```
|
| 45 |
+
Parse the JSON to understand:
|
| 46 |
+
- `schemaName`: The workflow being used (e.g., "spec-driven")
|
| 47 |
+
- `planningHome`, `changeRoot`, and `actionContext`: planning scope and edit constraints
|
| 48 |
+
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
|
| 49 |
+
|
| 50 |
+
3. **Get apply instructions**
|
| 51 |
+
|
| 52 |
+
```bash
|
| 53 |
+
openspec instructions apply --change "<name>" --json
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
This returns:
|
| 57 |
+
- `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
|
| 58 |
+
- Progress (total, complete, remaining)
|
| 59 |
+
- Task list with status, source path, and source line
|
| 60 |
+
- Dynamic instruction based on current state
|
| 61 |
+
- Optional `context`: current required project instruction input from the selected root
|
| 62 |
+
- Optional `operationGuidance`: current advisory guidance for apply
|
| 63 |
+
- `missingArtifacts` (when present): required artifact ids with no output
|
| 64 |
+
|
| 65 |
+
**Handle states:**
|
| 66 |
+
- If `state: "blocked"`: show the message and pause implementation.
|
| 67 |
+
- If `missingArtifacts` is non-empty: suggest completing the missing artifacts. Run `openspec status --change "<name>" --json`, select the next `ready` artifact (not `skipped` or `blocked`), and use `openspec instructions "<artifact-id>" --change "<name>" --json` for its rules and template. Keep the selected `--store <id>` on both commands.
|
| 68 |
+
- Otherwise, follow the CLI instruction to create or repair the schema-configured tracking file from existing planning artifacts. Do not assume another artifact is ready or start implementation while blocked.
|
| 69 |
+
- If `state: "all_done"`: report that all tracked tasks are complete and suggest review or verification as appropriate before archiving
|
| 70 |
+
- Otherwise: proceed to implementation
|
| 71 |
+
|
| 72 |
+
Treat `context` as a required prompt-level input. Read and consider it, and
|
| 73 |
+
apply relevant project facts, conventions, and constraints while implementing.
|
| 74 |
+
Treat `operationGuidance` as optional additive advice. Read and consider every
|
| 75 |
+
entry, and follow entries that are applicable and compatible with the built-in
|
| 76 |
+
workflow.
|
| 77 |
+
|
| 78 |
+
Keep both fields separate from CLI-returned state, missing artifacts, tasks,
|
| 79 |
+
progress, `contextFiles`, and the built-in `instruction`. They are not
|
| 80 |
+
evidence of task completion, do not replace the built-in instruction, and do
|
| 81 |
+
not permit bypassing a blocked state. If context conflicts with the built-in
|
| 82 |
+
instruction, an explicit user choice, or a CLI-controlled value, report the
|
| 83 |
+
conflict and preserve the controlling value. If guidance is inapplicable or
|
| 84 |
+
conflicts with those controlling inputs, do not follow it and explain why.
|
| 85 |
+
These are prompt-level behavior contracts, not enforceable checks.
|
| 86 |
+
|
| 87 |
+
4. **Read context files**
|
| 88 |
+
|
| 89 |
+
Read every file path listed under `contextFiles` from the apply instructions output.
|
| 90 |
+
The files depend on the schema being used:
|
| 91 |
+
- **spec-driven**: proposal, specs, design, tasks
|
| 92 |
+
- Other schemas: follow the contextFiles from CLI output
|
| 93 |
+
|
| 94 |
+
Do not copy `context` or `operationGuidance` verbatim into implementation
|
| 95 |
+
files or planning artifacts unless the user separately asks for that content.
|
| 96 |
+
|
| 97 |
+
5. **Show current progress**
|
| 98 |
+
|
| 99 |
+
Display:
|
| 100 |
+
- Schema being used
|
| 101 |
+
- Progress: "N/M tasks complete"
|
| 102 |
+
- Remaining tasks overview
|
| 103 |
+
- Dynamic instruction from CLI
|
| 104 |
+
|
| 105 |
+
6. **Implement tasks (loop until done or blocked)**
|
| 106 |
+
|
| 107 |
+
For each pending task:
|
| 108 |
+
- Show which task is being worked on
|
| 109 |
+
- Make the code changes required
|
| 110 |
+
- Keep changes minimal and focused
|
| 111 |
+
- Before editing, confirm the checkbox at the returned `sourcePath` and `line` still matches the task description; if it does not, rerun the apply instructions and use the refreshed location
|
| 112 |
+
- Mark the task complete at its returned `sourcePath` and `line`: `- [ ]` โ `- [x]`
|
| 113 |
+
- Rerun the apply instructions and confirm that task is now done and progress changed
|
| 114 |
+
- Continue to next task
|
| 115 |
+
|
| 116 |
+
**Pause if:**
|
| 117 |
+
- Task is unclear โ ask for clarification
|
| 118 |
+
- Implementation reveals a design issue โ suggest updating artifacts
|
| 119 |
+
- A task needs work beyond what the spec and tasks describe, or you are tempted to drop, narrow, defer, or accept exceptions to specified behavior to make it fit โ surface the added scope and ask; do not absorb it silently
|
| 120 |
+
- Error or blocker encountered โ report and wait for guidance
|
| 121 |
+
- User interrupts
|
| 122 |
+
|
| 123 |
+
7. **On completion or pause, show status**
|
| 124 |
+
|
| 125 |
+
Display:
|
| 126 |
+
- Tasks completed this session
|
| 127 |
+
- Overall progress: "N/M tasks complete"
|
| 128 |
+
- If all done: report that tracked tasks are complete and suggest review or verification as appropriate before archiving
|
| 129 |
+
- If paused: explain why and wait for guidance
|
| 130 |
+
|
| 131 |
+
**Output During Implementation**
|
| 132 |
+
|
| 133 |
+
```
|
| 134 |
+
## Implementing: <change-name> (schema: <schema-name>)
|
| 135 |
+
|
| 136 |
+
Working on task 3/7: <task description>
|
| 137 |
+
[...implementation happening...]
|
| 138 |
+
โ Task complete
|
| 139 |
+
|
| 140 |
+
Working on task 4/7: <task description>
|
| 141 |
+
[...implementation happening...]
|
| 142 |
+
โ Task complete
|
| 143 |
+
```
|
| 144 |
+
|
| 145 |
+
**Output On Completion**
|
| 146 |
+
|
| 147 |
+
```
|
| 148 |
+
## Implementation Complete
|
| 149 |
+
|
| 150 |
+
**Change:** <change-name>
|
| 151 |
+
**Schema:** <schema-name>
|
| 152 |
+
**Progress:** 7/7 tasks complete โ
|
| 153 |
+
|
| 154 |
+
### Completed This Session
|
| 155 |
+
- [x] Task 1
|
| 156 |
+
- [x] Task 2
|
| 157 |
+
...
|
| 158 |
+
|
| 159 |
+
All tracked tasks are complete. Review or verify the change as appropriate
|
| 160 |
+
before archiving. You can archive this change with `$openspec-archive-change (Codex) or /openspec-archive-change (other agents)`.
|
| 161 |
+
```
|
| 162 |
+
|
| 163 |
+
**Output On Pause (Issue Encountered)**
|
| 164 |
+
|
| 165 |
+
```
|
| 166 |
+
## Implementation Paused
|
| 167 |
+
|
| 168 |
+
**Change:** <change-name>
|
| 169 |
+
**Schema:** <schema-name>
|
| 170 |
+
**Progress:** 4/7 tasks complete
|
| 171 |
+
|
| 172 |
+
### Issue Encountered
|
| 173 |
+
<description of the issue>
|
| 174 |
+
|
| 175 |
+
**Options:**
|
| 176 |
+
1. <option 1>
|
| 177 |
+
2. <option 2>
|
| 178 |
+
3. Other approach
|
| 179 |
+
|
| 180 |
+
What would you like to do?
|
| 181 |
+
```
|
| 182 |
+
|
| 183 |
+
**Guardrails**
|
| 184 |
+
- Keep going through tasks until done or blocked
|
| 185 |
+
- Always read context files before starting (from the apply instructions output)
|
| 186 |
+
- If task is ambiguous, pause and ask before implementing
|
| 187 |
+
- If implementation reveals issues, pause and suggest artifact updates
|
| 188 |
+
- Keep code changes minimal and scoped to each task
|
| 189 |
+
- Update task checkbox immediately after completing each task
|
| 190 |
+
- Pause on errors, blockers, or unclear requirements - don't guess
|
| 191 |
+
- When a task needs work beyond what the spec describes, surface the added scope and pause - never silently narrow, defer, or simplify away specified behavior
|
| 192 |
+
- Only mark a task `- [x]` when its specified behavior is fully implemented, not when it is partially done or deferred
|
| 193 |
+
- Use contextFiles from CLI output, don't assume specific file names
|
| 194 |
+
- Use each task's sourcePath and line to update its exact checkbox
|
| 195 |
+
- Do not use context or operation guidance as proof that a task is complete
|
| 196 |
+
- Apply relevant project context; report conflicts with controlling workflow inputs
|
| 197 |
+
- Consider every guidance entry; explain any inapplicable or conflicting advice
|
| 198 |
+
- Do not copy runtime context or operation guidance into implementation files or planning artifacts
|
| 199 |
+
- Preserve CLI-controlled blocked/ready/all-done behavior and completion criteria
|
| 200 |
+
|
| 201 |
+
**Fluid Workflow Integration**
|
| 202 |
+
|
| 203 |
+
This skill supports the "actions on a change" model:
|
| 204 |
+
|
| 205 |
+
- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
|
| 206 |
+
- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
|
.agents/skills/openspec-archive-change/SKILL.md
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: openspec-archive-change
|
| 3 |
+
description: Archive a completed OpenSpec change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete. Also use when the user says "openspec archive" or "opsx archive".
|
| 4 |
+
allowed-tools: Bash(openspec:*)
|
| 5 |
+
license: MIT
|
| 6 |
+
compatibility: Requires openspec CLI.
|
| 7 |
+
metadata:
|
| 8 |
+
author: openspec
|
| 9 |
+
version: "1.0"
|
| 10 |
+
generatedBy: "1.14.3"
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
Archive a completed change in the experimental workflow.
|
| 14 |
+
|
| 15 |
+
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
| 16 |
+
|
| 17 |
+
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
| 18 |
+
|
| 19 |
+
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
| 20 |
+
|
| 21 |
+
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
| 22 |
+
|
| 23 |
+
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
| 24 |
+
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
| 25 |
+
|
| 26 |
+
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
| 27 |
+
|
| 28 |
+
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
|
| 29 |
+
|
| 30 |
+
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
| 31 |
+
|
| 32 |
+
**Steps**
|
| 33 |
+
|
| 34 |
+
1. **Select the change**
|
| 35 |
+
|
| 36 |
+
If a name is provided, use it. Otherwise:
|
| 37 |
+
- Infer from conversation context if the user mentioned a change
|
| 38 |
+
- Auto-select if only one active change exists
|
| 39 |
+
- If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
|
| 40 |
+
|
| 41 |
+
When prompting, show only active changes (not already archived).
|
| 42 |
+
Include the schema used for each change if available.
|
| 43 |
+
|
| 44 |
+
Always announce: "Using change: <name>" and how to override (e.g., `$openspec-archive-change (Codex) or /openspec-archive-change (other agents) <other>`).
|
| 45 |
+
|
| 46 |
+
**Load current archive inputs before the existing archive checks:**
|
| 47 |
+
|
| 48 |
+
After resolving the selected change and planning root, run:
|
| 49 |
+
```bash
|
| 50 |
+
openspec instructions archive --change "<name>" --json
|
| 51 |
+
```
|
| 52 |
+
Keep the same selected-root flags on this command. This lookup is advisory and
|
| 53 |
+
optional: it only supplies extra prompt inputs, so it must never block archiving.
|
| 54 |
+
If it exits non-zero or returns invalid JSON โ for example on an older CLI that
|
| 55 |
+
does not support this command yet โ continue the archive workflow with no
|
| 56 |
+
context and no operation guidance. Do not report an error and do not stop.
|
| 57 |
+
|
| 58 |
+
A successful response may omit both optional fields. Treat `context` as a
|
| 59 |
+
required prompt-level input: read and consider it, and apply relevant project
|
| 60 |
+
facts, conventions, and constraints. Treat `operationGuidance` as optional
|
| 61 |
+
additive advice: read and consider every entry, and follow entries that are
|
| 62 |
+
applicable and compatible with the built-in archive workflow.
|
| 63 |
+
|
| 64 |
+
Keep both fields separate from built-in steps, explicit user choices, resolved
|
| 65 |
+
paths, CLI checks, and command contracts. If context conflicts with one of those
|
| 66 |
+
controlling inputs, report the conflict and preserve the controlling value. If
|
| 67 |
+
guidance is inapplicable or conflicts with a controlling input, do not follow it
|
| 68 |
+
and explain why. Do not infer replacement paths, skipped prompts, or flags from
|
| 69 |
+
either field, and do not copy their text verbatim into specs, change artifacts,
|
| 70 |
+
or archive summaries unless the user separately asks for it. These are
|
| 71 |
+
prompt-level behavior contracts, not enforceable checks.
|
| 72 |
+
|
| 73 |
+
2. **Check artifact completion status**
|
| 74 |
+
|
| 75 |
+
Run `openspec status --change "<name>" --json` to check artifact completion.
|
| 76 |
+
|
| 77 |
+
Parse the JSON to understand:
|
| 78 |
+
- `schemaName`: The workflow being used
|
| 79 |
+
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context
|
| 80 |
+
- `artifacts`: List of artifacts with their status (`done`, `skipped`, or other)
|
| 81 |
+
|
| 82 |
+
**If any artifacts are neither `done` nor `skipped`** (skipped artifacts satisfy the requirement - the change declares skip_specs):
|
| 83 |
+
- Display warning listing incomplete artifacts
|
| 84 |
+
- Ask the user to confirm they want to proceed
|
| 85 |
+
- Proceed if user confirms
|
| 86 |
+
|
| 87 |
+
3. **Check task completion status**
|
| 88 |
+
|
| 89 |
+
Run `openspec list --json` with the same selected-root flags and find the
|
| 90 |
+
entry in `changes` whose `name` exactly matches the selected change.
|
| 91 |
+
Require exactly one match and nonnegative integer `totalTasks` and
|
| 92 |
+
`completedTasks`, with `completedTasks <= totalTasks`. The CLI resolves
|
| 93 |
+
the schema's tracked task files, including custom artifact names, output
|
| 94 |
+
paths, and globs.
|
| 95 |
+
Incomplete tasks = `totalTasks - completedTasks`.
|
| 96 |
+
|
| 97 |
+
Do not infer task completion from artifact status or the absence of a
|
| 98 |
+
top-level `tasks.md`. If the lookup fails, returns invalid JSON, omits or
|
| 99 |
+
duplicates the selected change, or returns invalid counts, report the problem
|
| 100 |
+
and stop before syncing or archiving.
|
| 101 |
+
The CLI counts only `x`/`X` checkbox markers as complete;
|
| 102 |
+
other markers, including unfamiliar ones, remain incomplete.
|
| 103 |
+
|
| 104 |
+
**If incomplete tasks found:**
|
| 105 |
+
- Display warning showing count of incomplete tasks
|
| 106 |
+
- Ask the user to confirm they want to proceed
|
| 107 |
+
- Proceed if user confirms
|
| 108 |
+
|
| 109 |
+
**If `totalTasks` is zero:** Proceed without a task-related warning.
|
| 110 |
+
|
| 111 |
+
4. **Assess delta spec sync state**
|
| 112 |
+
|
| 113 |
+
Use `artifactPaths.specs.existingOutputPaths` from status JSON as the only
|
| 114 |
+
delta-spec source. If the `specs` entry is missing or
|
| 115 |
+
`existingOutputPaths` is empty, proceed without a sync prompt and do not infer
|
| 116 |
+
delta specs from other artifacts.
|
| 117 |
+
|
| 118 |
+
**If delta specs exist:**
|
| 119 |
+
- Compare each delta spec with its corresponding main spec at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (use the store-aware `planningHome.root` from step 2, not a hardcoded repo path)
|
| 120 |
+
- A missing main spec is **not automatically** "already synced". For a new capability, the main spec is an *output* of the sync, not an input:
|
| 121 |
+
- If the delta has MODIFIED or RENAMED requirements, report that only ADDED requirements can create a new main spec and mark that capability as sync-blocked. Never invent a requirement that has no current version.
|
| 122 |
+
- Otherwise, if the delta has only REMOVED requirements and the change's `.openspec.yaml` declares `retire_capabilities: true`, the capability is already retired: count it as already synced, warn that there is nothing left to remove, and do not recreate the main spec. Apply this rule both now and when verifying a completed sync.
|
| 123 |
+
- Otherwise, if the delta has no ADDED requirements, report that no sync is possible and mark that capability as sync-blocked. For a REMOVED-only delta, warn that there is no main spec to remove from and leave the main-spec tree unchanged. `openspec archive` refuses the unmarked REMOVED-only case with `Spec must have at least one requirement`.
|
| 124 |
+
- Otherwise, count the capability as needing sync and name it in the summary (`<capability-path>: new main spec will be created`). If the delta also has REMOVED requirements, warn that they will be ignored because there is no main spec to remove from. The sync creates the main spec from only the delta's ADDED requirements, exactly as `openspec archive` does.
|
| 125 |
+
- Determine what changes would be applied (adds, modifications, removals, renames)
|
| 126 |
+
- Continue assessing the remaining capabilities even when one is sync-blocked. Show a combined summary before prompting.
|
| 127 |
+
|
| 128 |
+
**Prompt options:**
|
| 129 |
+
- If any capability is sync-blocked: explain why and offer only "Archive without syncing", "Cancel"
|
| 130 |
+
- Otherwise, if changes needed: "Sync now (recommended)", "Archive without syncing"
|
| 131 |
+
- Otherwise, if already synced: "Archive now", "Sync anyway", "Cancel"
|
| 132 |
+
|
| 133 |
+
Route on the answer:
|
| 134 |
+
- "Cancel" โ stop, do not archive
|
| 135 |
+
- "Archive without syncing" or "Archive now" โ proceed to archive
|
| 136 |
+
- "Sync now" or "Sync anyway" โ sync, then verify (below). Do not start any sync while a capability is sync-blocked; explain the blocker and repeat the available choices.
|
| 137 |
+
- Anything else โ ask again rather than archiving
|
| 138 |
+
|
| 139 |
+
Before a selected sync writes any main spec, run
|
| 140 |
+
`openspec instructions specs --change "<name>" --json` once with the same
|
| 141 |
+
selected-root flags. Require a zero exit status and valid artifact-instruction
|
| 142 |
+
JSON. If the lookup fails or returns invalid JSON, report the error and stop
|
| 143 |
+
before writing any main spec or moving the change. A valid response with omitted
|
| 144 |
+
`rules` is the no-rules case. Apply returned `rules` only to the content and
|
| 145 |
+
form of main specs produced by this merge; do not use them as archive guidance,
|
| 146 |
+
change CLI behavior, or copy the rule text into any output file.
|
| 147 |
+
|
| 148 |
+
Then run the `openspec-sync-specs` workflow inline (agent-driven intelligent merge) for change '<name>', passing the delta spec analysis and the fetched specs-rule snapshot from above, and wait for it to finish. The inline sync must reuse that snapshot without fetching `specs` instructions again. Do not delegate it to a background task โ step 5 would move `changeRoot` out from under a sync that is still reading it, leaving the change archived and the main specs never updated. If your agent can only run it by delegation, delegate synchronously and wait for the result.
|
| 149 |
+
|
| 150 |
+
If the sync reports any stop or blocking condition, treat the sync as failed.
|
| 151 |
+
Stop the archive immediately. Do not perform the post-sync content comparison and do not move its `changeRoot`.
|
| 152 |
+
Nothing has moved, so the user can fix the blocking condition or re-run the sync.
|
| 153 |
+
|
| 154 |
+
After the sync writes each main spec, verify its structure against the canonical sync contract:
|
| 155 |
+
- A new main spec starts with a `# <capability> Specification` title. An existing main spec keeps its title exactly as it is.
|
| 156 |
+
- Preserve existing `## Purpose` sections completely untouched for established main specs.
|
| 157 |
+
- For a new main spec, copy the delta `## Purpose` verbatim. Warn only if the purpose text is shorter than standard validation expects. Do not regenerate or rewrite existing authored purpose. If no usable `## Purpose` is provided, use the existing TBD Purpose behavior and warning.
|
| 158 |
+
- Verify that no delta-style section headers (`## ADDED Requirements`, `## MODIFIED Requirements`, `## REMOVED Requirements`, `## RENAMED Requirements`) remain in the main spec, adhering strictly to the sync workflow formatting rules.
|
| 159 |
+
- Requirement blocks the sync wrote or changed use `### Requirement:` headings, and their scenarios use `#### Scenario:` headings, under the spec's `## Requirements` section. Leave content the delta does not mention exactly as it is.
|
| 160 |
+
|
| 161 |
+
Then re-run the comparison from the top of this step, including the explicitly retired, missing-spec case, against every capability that has a delta spec in `artifactPaths.specs.existingOutputPaths` โ not only the ones the sync reports it touched. A successful sync leaves nothing left to apply, so each capability must now read as already synced:
|
| 162 |
+
- ADDED requirements present
|
| 163 |
+
- MODIFIED requirements carrying the scenario and description changes named in the delta, with their other scenarios intact
|
| 164 |
+
- REMOVED requirements gone โ and where this sync retired a capability (removed its last requirement, leaving `## Requirements` empty), its main spec deleted rather than left empty.
|
| 165 |
+
- RENAMED requirements present under the new name and absent under the old one
|
| 166 |
+
|
| 167 |
+
If the sync failed, or any capability does not match, report what differs and stop โ do not archive. Nothing has moved and `changeRoot` is intact, so the user can fix the mismatch or re-run the sync and start the archive again.
|
| 168 |
+
|
| 169 |
+
5. **Perform the archive**
|
| 170 |
+
|
| 171 |
+
Create an `archive` directory under `planningHome.changesDir` if it doesn't exist:
|
| 172 |
+
```bash
|
| 173 |
+
mkdir -p "<planningHome.changesDir>/archive"
|
| 174 |
+
```
|
| 175 |
+
|
| 176 |
+
Generate the target name: use the change name as-is when it already starts with a `YYYY-MM-DD-` prefix; otherwise prepend the current date as `YYYY-MM-DD-<change-name>`. Never stack a second date (same rule as `openspec archive`).
|
| 177 |
+
|
| 178 |
+
**Check if target already exists:**
|
| 179 |
+
- If yes: Fail with error, suggest renaming existing archive or using different date
|
| 180 |
+
- If no: Move `changeRoot` to the archive directory
|
| 181 |
+
|
| 182 |
+
```bash
|
| 183 |
+
mv "<changeRoot>" "<planningHome.changesDir>/archive/<target-name>"
|
| 184 |
+
```
|
| 185 |
+
|
| 186 |
+
6. **Display summary**
|
| 187 |
+
|
| 188 |
+
Show archive completion summary including:
|
| 189 |
+
- Change name
|
| 190 |
+
- Schema that was used
|
| 191 |
+
- Archive location
|
| 192 |
+
- Whether specs were synced (if applicable)
|
| 193 |
+
- Note about any warnings (incomplete artifacts/tasks)
|
| 194 |
+
|
| 195 |
+
**Output On Success**
|
| 196 |
+
|
| 197 |
+
```markdown
|
| 198 |
+
## Archive Complete
|
| 199 |
+
|
| 200 |
+
**Change:** <change-name>
|
| 201 |
+
**Schema:** <schema-name>
|
| 202 |
+
**Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
|
| 203 |
+
**Specs:** <"โ Synced to main specs" only if the step 4 verification passed; otherwise "No delta specs" or "Sync skipped">
|
| 204 |
+
|
| 205 |
+
<"All artifacts complete. All tasks complete." โ or, if archived with warnings, list them instead (e.g. "Archived with 2 incomplete tasks")>
|
| 206 |
+
```
|
| 207 |
+
|
| 208 |
+
**Guardrails**
|
| 209 |
+
- Announce the selected change; prompt for selection when it is ambiguous
|
| 210 |
+
- Use artifact graph (openspec status --json) for completion checking
|
| 211 |
+
- Don't block archive on warnings - just inform and confirm
|
| 212 |
+
- Preserve .openspec.yaml when moving to archive (it moves with the directory)
|
| 213 |
+
- Show clear summary of what happened
|
| 214 |
+
- If sync is requested, run the `openspec-sync-specs` workflow inline (agent-driven)
|
| 215 |
+
- Never archive while a spec sync is still in flight โ run the sync inline and verify the main specs before moving `changeRoot`
|
| 216 |
+
- If delta specs exist, always run the sync assessment and show the combined summary before prompting
|
| 217 |
+
- Apply relevant runtime context and report conflicts; operation guidance remains advisory
|
| 218 |
+
- Consider every guidance entry and explain any inapplicable or conflicting advice
|
| 219 |
+
- Existing CLI checks, resolved paths, prompts, and command contracts are unchanged
|
| 220 |
+
- Artifact rules constrain only the specs being written and are never operation guidance
|
| 221 |
+
- Never copy runtime context, operation guidance, or artifact-rule text verbatim into output files
|
.agents/skills/openspec-explore/SKILL.md
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: openspec-explore
|
| 3 |
+
description: Enter OpenSpec explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements in a project that uses OpenSpec. Use when the user wants to think through something before or during an OpenSpec change. Also use when the user says "openspec explore" or "opsx explore".
|
| 4 |
+
allowed-tools: Bash(openspec:*)
|
| 5 |
+
license: MIT
|
| 6 |
+
compatibility: Requires openspec CLI.
|
| 7 |
+
metadata:
|
| 8 |
+
author: openspec
|
| 9 |
+
version: "1.0"
|
| 10 |
+
generatedBy: "1.14.3"
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
|
| 14 |
+
|
| 15 |
+
**IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, investigate the codebase, and run read-only commands or tools without confirmation, but you must NEVER write code or implement features. If the user asks you to implement something, do not start it here: say that explore mode does not implement, and point them at `$openspec-propose (Codex) or /openspec-propose (other agents)`, which turns the discussion into a change. The work happens from that change, never from explore mode. You MAY create or update OpenSpec change artifacts (proposals, designs, specs) within a confirmed scopeโthat's capturing thinking, not implementing. Answering design or clarifying questions is never consent to write. Before the first write-capable action, name the artifacts or files you would change and what you would do, ask a direct yes/no question, and wait for the user's confirmation in a separate message. Confirmation covers only the scope you described; ask again before expanding it. An explicit request from the user to capture the exploration as a new change is itself that confirmation, covering the change and the change artifacts the request names; scaffold it first as described below.
|
| 16 |
+
|
| 17 |
+
**This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
|
| 18 |
+
|
| 19 |
+
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
| 20 |
+
|
| 21 |
+
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
| 22 |
+
|
| 23 |
+
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
| 24 |
+
|
| 25 |
+
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
| 26 |
+
|
| 27 |
+
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
| 28 |
+
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
| 29 |
+
|
| 30 |
+
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
| 31 |
+
|
| 32 |
+
---
|
| 33 |
+
|
| 34 |
+
## The Stance
|
| 35 |
+
|
| 36 |
+
- **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
|
| 37 |
+
- **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
|
| 38 |
+
- **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
|
| 39 |
+
- **Adaptive** - Follow interesting threads, pivot when new information emerges
|
| 40 |
+
- **Patient** - Don't rush to conclusions, let the shape of the problem emerge
|
| 41 |
+
- **Grounded** - Explore the actual codebase when relevant, don't just theorize
|
| 42 |
+
|
| 43 |
+
---
|
| 44 |
+
|
| 45 |
+
## Planning a Change
|
| 46 |
+
|
| 47 |
+
When the user is planning a change, guide them toward shared understanding with focused discovery questions. For open-ended discussion, follow the conversation without imposing an interview or a required output.
|
| 48 |
+
|
| 49 |
+
Before asking a factual question, follow the context discovery below and inspect relevant OpenSpec artifacts, source, tests, docs, and configuration. Do not ask the user to repeat facts you can verify. Summarize relevant findings without reproducing private context or rules. If evidence is missing, conflicting, or inaccessible, state that limitation and ask only for the clarification needed to proceed.
|
| 50 |
+
|
| 51 |
+
- **Follow dependencies** - Resolve the next blocking decision before its dependent details. For example, clarify the user's outcome and scope before choosing an API or data model. Revisit downstream assumptions when an earlier answer changes. Skip branches that do not matter to this goal.
|
| 52 |
+
- **Keep questions focused** - Ask one focused question at a time, and briefly explain why it matters and which decision it unlocks. Batch questions only if the user asks for a batch; keep them small and group related decisions.
|
| 53 |
+
- **Offer grounded recommendations** - When evidence supports a recommendation, state your preferred option and why it fits the user's goals, with alternatives and their tradeoffs when useful. Do not invent intent, priorities, or external constraints: ask the user when only they can answer. Avoid a fixed question format.
|
| 54 |
+
- **Keep a conversational record** - Track decisions in the conversation, not in files. Separate confirmed decisions from proposed defaults and unresolved questions. Silence is not acceptance. Accepting an answer or a batch of recommendations is not permission to write. Keep file-write confirmation separate from discovery questions and follow the guardrails below.
|
| 55 |
+
|
| 56 |
+
Stop asking when the user has enough clarity. Let them pause, pivot, or defer a decision; do not exhaust every branch or force a proposal.
|
| 57 |
+
|
| 58 |
+
For example, after inspecting the relevant code:
|
| 59 |
+
|
| 60 |
+
```text
|
| 61 |
+
The CLI already uses SQLite and has no remote service. Is sharing state
|
| 62 |
+
across devices in scope? That determines whether local storage is enough.
|
| 63 |
+
If this stays a single-device tool, I recommend keeping SQLite to avoid
|
| 64 |
+
adding a service to operate; shared state would need a separate sync design.
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
---
|
| 68 |
+
|
| 69 |
+
## What You Might Do
|
| 70 |
+
|
| 71 |
+
Depending on what the user brings, you might:
|
| 72 |
+
|
| 73 |
+
**Explore the problem space**
|
| 74 |
+
- Ask clarifying questions that emerge from what they said
|
| 75 |
+
- Challenge assumptions
|
| 76 |
+
- Reframe the problem
|
| 77 |
+
- Find analogies
|
| 78 |
+
|
| 79 |
+
**Investigate the codebase**
|
| 80 |
+
- Map existing architecture relevant to the discussion
|
| 81 |
+
- Find integration points
|
| 82 |
+
- Identify patterns already in use
|
| 83 |
+
- Surface hidden complexity
|
| 84 |
+
|
| 85 |
+
**Compare options**
|
| 86 |
+
- Brainstorm multiple approaches
|
| 87 |
+
- Build comparison tables
|
| 88 |
+
- Sketch tradeoffs
|
| 89 |
+
- Recommend a path (if asked)
|
| 90 |
+
|
| 91 |
+
**Visualize**
|
| 92 |
+
```
|
| 93 |
+
+------------------------------------------+
|
| 94 |
+
| Use ASCII diagrams liberally |
|
| 95 |
+
+------------------------------------------+
|
| 96 |
+
| |
|
| 97 |
+
| [State A] -------> [State B] |
|
| 98 |
+
| | |
|
| 99 |
+
| v |
|
| 100 |
+
| [State C] |
|
| 101 |
+
| |
|
| 102 |
+
| System diagrams, state machines, |
|
| 103 |
+
| data flows, architecture sketches, |
|
| 104 |
+
| dependency graphs, comparison tables |
|
| 105 |
+
| |
|
| 106 |
+
+------------------------------------------+
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
**Draw with plain ASCII only** โ borders `+` `-` `|`, arrows `-->` `<--` `^` `v`, markers `*` `x`.
|
| 110 |
+
Unicode diagram glyphs can render at different widths across terminals, fonts, and locales, so padded boxes and aligned tables can drift. Keep every diagram character ASCII.
|
| 111 |
+
|
| 112 |
+
**Surface risks and unknowns**
|
| 113 |
+
- Identify what could go wrong
|
| 114 |
+
- Find gaps in understanding
|
| 115 |
+
- Suggest spikes or investigations
|
| 116 |
+
|
| 117 |
+
---
|
| 118 |
+
|
| 119 |
+
## OpenSpec Awareness
|
| 120 |
+
|
| 121 |
+
You have full context of the OpenSpec system. Use it naturally, don't force it.
|
| 122 |
+
|
| 123 |
+
### Check for context
|
| 124 |
+
|
| 125 |
+
At the start, quickly check what exists:
|
| 126 |
+
```bash
|
| 127 |
+
openspec list --json
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
This tells you:
|
| 131 |
+
- If there are active changes
|
| 132 |
+
- Their names and task status
|
| 133 |
+
- What the user might be working on
|
| 134 |
+
|
| 135 |
+
That is the *change* list - work in flight. It does not include the project's durable capabilities, so list those too:
|
| 136 |
+
```bash
|
| 137 |
+
openspec list --specs
|
| 138 |
+
```
|
| 139 |
+
Add `--json` for ids and requirement counts, and append `--store "<id>"` only for a registered standalone store. This is the inventory of what the project already claims to do, and `openspec list` on its own never shows it. To look at one, run `openspec show "<spec-id>" --type spec --json --no-scenarios` (same `--store` rule) - it returns that capability's purpose and requirement texts without pulling the whole spec file into context, and `--type spec` stops a change of the same name from making it ambiguous.
|
| 140 |
+
|
| 141 |
+
The filtered read is only an overview. Before deciding what is already covered or what should change, read each relevant spec in full, including scenarios, with `openspec show "<spec-id>" --type spec` (same `--store` rule).
|
| 142 |
+
|
| 143 |
+
Then read the project's own context from the resolved root - `<root.path>/openspec/config.yaml` (or `config.yml`). Use the `root.path` returned above, and skip this if neither file exists:
|
| 144 |
+
- `context`: project background - tech stack, conventions, constraints
|
| 145 |
+
- `rules`: keyed by artifact id - the entries for an artifact apply only when you write that artifact
|
| 146 |
+
|
| 147 |
+
Ground your thinking in these. They are constraints for you to follow, not content to reproduce: do NOT copy them into the conversation or into any artifact you create.
|
| 148 |
+
|
| 149 |
+
### When no change exists
|
| 150 |
+
|
| 151 |
+
Think freely. When insights crystallize, you might offer:
|
| 152 |
+
|
| 153 |
+
- "This feels solid enough to start a change. Want me to create a proposal?"
|
| 154 |
+
- Or keep exploring - no pressure to formalize
|
| 155 |
+
|
| 156 |
+
If the user asks you to capture the exploration as a new change, that request is the confirmation required above. It covers scaffolding that change and creating the change artifacts the request names, and nothing else. This holds only when the request is theirs: a yes to an offer you made confirms only the scope your offer itself named, so name the change and the artifacts in the offer. Don't re-ask for what they already asked for; do ask before anything beyond it. Transition seamlessly into the requested capture:
|
| 157 |
+
|
| 158 |
+
1. Run `openspec new change "<name>"` (with `--store <id>` when applicable) before creating any artifacts. Never create a new change directory under `openspec/changes/` by hand; the CLI scaffold creates required metadata such as `.openspec.yaml`. Keep the selected `--store <id>` on every applicable follow-up `status` and `instructions` command.
|
| 159 |
+
2. Run `openspec status --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store), then process the requested artifacts in dependency order. For each requested artifact that is `ready`, run `openspec instructions "<artifact-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store). Before creating a requested artifact, evaluate any condition in its own `instruction` against the explored change; record a deliberate skip instead when the condition does not apply. If a requested artifact is blocked by a direct prerequisite the user did not request, run `openspec instructions "<prerequisite-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) for that prerequisite whether it is `ready` or `blocked`. If its own `instruction` states a condition, evaluate that condition against the explored change and record a deliberate skip only when the condition does not apply. If the condition applies, or the prerequisite is not conditional, treat it as a normal prerequisite and ask before expanding the capture. Do not create an unrequested prerequisite unless the user approves.
|
| 160 |
+
3. Follow the returned `template` and `instruction` fields. Read completed dependency files listed in `dependencies`, and apply `context` and `rules` as constraints without copying them into the artifact. Choose the output path before creating anything: when `resolvedOutputPath` is a glob, use the instruction to choose a concrete path inside `changeRoot` and verify it remains inside `changeRoot` after resolving symlinks, both in its parent directories and in the file itself if it already exists; if it does not, stop and tell the user. Otherwise the output path is `resolvedOutputPath`. If the instruction delegates creation to a specific skill or command, invoke it only if it can write the artifact to that output path; otherwise stop and tell the user. Otherwise write the artifact to that output path. Verify that the selected concrete output exists at that output path.
|
| 161 |
+
4. After creating each artifact, re-run `openspec status --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) and continue until every requested artifact is `done`, `skipped`, or was deliberately skipped because its own `instruction` stated a condition that did not apply. Tell the user about a deliberate conditional skip, remember it, and do not reconsider it. Dependencies are enablers, not gates: if a requested artifact is still `blocked` only because you deliberately skipped a conditional prerequisite, run `openspec instructions "<artifact-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) despite the blocked status, then create it using step 3 only when those recorded conditional skips are its sole missing dependencies. If a requested artifact is blocked by a prerequisite the user did not ask to capture and cannot be conditionally skipped, explain that dependency and ask before expanding the capture.
|
| 162 |
+
|
| 163 |
+
Capture the artifact(s) the user requested without asking them to invoke another workflow command. If they asked only to start a change, stop after scaffolding and show its status. When the requested capture is done, stop there and name where the work continues: `$openspec-propose (Codex) or /openspec-propose (other agents)` writes the remaining planning artifacts, and `$openspec-apply-change (Codex) or /openspec-apply-change (other agents)` implements the change once tasks exist. Capturing artifacts never starts implementing them.
|
| 164 |
+
|
| 165 |
+
### When a change exists
|
| 166 |
+
|
| 167 |
+
If the user mentions a change or you detect one is relevant:
|
| 168 |
+
|
| 169 |
+
1. **Resolve and read existing artifacts for context**
|
| 170 |
+
- Run `openspec status --change "<name>" --json`.
|
| 171 |
+
- Use `changeRoot`, `artifactPaths`, and `actionContext` from the status JSON.
|
| 172 |
+
- Read existing files from `artifactPaths.<artifact>.existingOutputPaths`.
|
| 173 |
+
|
| 174 |
+
2. **Reference them naturally in conversation**
|
| 175 |
+
- "Your design mentions using Redis, but we just realized SQLite fits better..."
|
| 176 |
+
- "The proposal scopes this to premium users, but we're now thinking everyone..."
|
| 177 |
+
|
| 178 |
+
3. **Offer to capture when decisions are made**
|
| 179 |
+
|
| 180 |
+
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
|
| 181 |
+
|
| 182 |
+
The files below are the default spec-driven schema's. With another schema, capture each insight in whichever artifact from `artifactPaths` fits it, and name that artifact in your offer; never create an artifact the schema does not define.
|
| 183 |
+
|
| 184 |
+
| Insight Type | Where to Capture |
|
| 185 |
+
|----------------------------|-------------------------------------|
|
| 186 |
+
| New requirement discovered | `specs/<capability-path>/spec.md` |
|
| 187 |
+
| Requirement changed | `specs/<capability-path>/spec.md` |
|
| 188 |
+
| Design decision made | `design.md` |
|
| 189 |
+
| Scope changed | `proposal.md` |
|
| 190 |
+
| New work identified | `tasks.md` |
|
| 191 |
+
| Assumption invalidated | Relevant artifact |
|
| 192 |
+
|
| 193 |
+
Example offers (default schema):
|
| 194 |
+
- "That's a design decision. Capture it in design.md?"
|
| 195 |
+
- "This is a new requirement. Add it to specs?"
|
| 196 |
+
- "This changes scope. Update the proposal?"
|
| 197 |
+
|
| 198 |
+
4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
|
| 199 |
+
|
| 200 |
+
---
|
| 201 |
+
|
| 202 |
+
## What You Don't Have To Do
|
| 203 |
+
|
| 204 |
+
- Follow a script
|
| 205 |
+
- Ask the same questions every time
|
| 206 |
+
- Produce a specific artifact
|
| 207 |
+
- Reach a conclusion
|
| 208 |
+
- Stay on topic if a tangent is valuable
|
| 209 |
+
- Be brief (this is thinking time)
|
| 210 |
+
|
| 211 |
+
---
|
| 212 |
+
|
| 213 |
+
## Handling Different Entry Points
|
| 214 |
+
|
| 215 |
+
**User brings a vague idea:**
|
| 216 |
+
```
|
| 217 |
+
User: I'm thinking about adding real-time collaboration
|
| 218 |
+
|
| 219 |
+
You: Real-time collab is a big space. Let me think about this...
|
| 220 |
+
|
| 221 |
+
COLLABORATION SPECTRUM
|
| 222 |
+
============================================
|
| 223 |
+
|
| 224 |
+
Awareness Coordination Sync
|
| 225 |
+
| | |
|
| 226 |
+
v v v
|
| 227 |
+
+--------+ +--------+ +--------+
|
| 228 |
+
|Presence| |Cursors | | CRDT |
|
| 229 |
+
| "3 | | Multi | |Conflict|
|
| 230 |
+
|online" | | select | | free |
|
| 231 |
+
+--------+ +--------+ +--------+
|
| 232 |
+
| | |
|
| 233 |
+
trivial moderate complex
|
| 234 |
+
|
| 235 |
+
Where's your head at?
|
| 236 |
+
```
|
| 237 |
+
|
| 238 |
+
**User brings a specific problem:**
|
| 239 |
+
```
|
| 240 |
+
User: The auth system is a mess
|
| 241 |
+
|
| 242 |
+
You: [reads codebase]
|
| 243 |
+
|
| 244 |
+
+---------------------------------------------+
|
| 245 |
+
| CURRENT AUTH FLOW |
|
| 246 |
+
+---------------------------------------------+
|
| 247 |
+
|
|
| 248 |
+
+-------------+-------------+
|
| 249 |
+
v v v
|
| 250 |
+
+---------+ +---------+ +---------+
|
| 251 |
+
| Google | | GitHub | | Email |
|
| 252 |
+
| OAuth | | OAuth | | Magic |
|
| 253 |
+
+----+----+ +----+----+ +----+----+
|
| 254 |
+
| | |
|
| 255 |
+
+-------------+-------------+
|
| 256 |
+
v
|
| 257 |
+
+-----------+
|
| 258 |
+
| Session |
|
| 259 |
+
+-----+-----+
|
| 260 |
+
|
|
| 261 |
+
v
|
| 262 |
+
+-----------+
|
| 263 |
+
| Perms |
|
| 264 |
+
+-----------+
|
| 265 |
+
|
| 266 |
+
I see three tangles. Which one's burning?
|
| 267 |
+
```
|
| 268 |
+
|
| 269 |
+
**User is stuck mid-implementation:**
|
| 270 |
+
```
|
| 271 |
+
User: $openspec-explore (Codex) or /openspec-explore (other agents) add-auth-system
|
| 272 |
+
The OAuth integration is more complex than expected
|
| 273 |
+
|
| 274 |
+
You: [reads change artifacts]
|
| 275 |
+
|
| 276 |
+
You're on task 4: "Implement OAuth flow"
|
| 277 |
+
|
| 278 |
+
Let me trace what's involved...
|
| 279 |
+
|
| 280 |
+
[draws diagram, explores options, suggests paths]
|
| 281 |
+
|
| 282 |
+
Want to update the design to reflect this?
|
| 283 |
+
Or add a spike task to investigate?
|
| 284 |
+
```
|
| 285 |
+
|
| 286 |
+
**User wants to compare options:**
|
| 287 |
+
```
|
| 288 |
+
User: Should we use Postgres or SQLite?
|
| 289 |
+
|
| 290 |
+
You: Generic answer is boring. What's the context?
|
| 291 |
+
|
| 292 |
+
User: A CLI tool that tracks local dev environments
|
| 293 |
+
|
| 294 |
+
You: That changes everything.
|
| 295 |
+
|
| 296 |
+
+-------------------------------------------------+
|
| 297 |
+
| CLI TOOL DATA STORAGE |
|
| 298 |
+
+-------------------------------------------------+
|
| 299 |
+
|
| 300 |
+
Key constraints:
|
| 301 |
+
- No daemon running
|
| 302 |
+
- Must work offline
|
| 303 |
+
- Single user
|
| 304 |
+
|
| 305 |
+
SQLite Postgres
|
| 306 |
+
Deployment embedded needs server
|
| 307 |
+
Offline yes no
|
| 308 |
+
Single file yes no
|
| 309 |
+
|
| 310 |
+
SQLite. Not even close.
|
| 311 |
+
|
| 312 |
+
Unless... is there a sync component?
|
| 313 |
+
```
|
| 314 |
+
|
| 315 |
+
---
|
| 316 |
+
|
| 317 |
+
## Ending Discovery
|
| 318 |
+
|
| 319 |
+
There's no required ending. Discovery might:
|
| 320 |
+
|
| 321 |
+
- **Flow into a proposal**: "Ready to start? Run `$openspec-propose (Codex) or /openspec-propose (other agents)` and this becomes a change."
|
| 322 |
+
- **Result in artifact updates**: "Updated the design with these decisions"
|
| 323 |
+
- **Just provide clarity**: User has what they need, moves on
|
| 324 |
+
- **Continue later**: "We can pick this up anytime"
|
| 325 |
+
|
| 326 |
+
When it feels like things are crystallizing, you might summarize:
|
| 327 |
+
|
| 328 |
+
```
|
| 329 |
+
## What We Figured Out
|
| 330 |
+
|
| 331 |
+
**The problem**: [crystallized understanding]
|
| 332 |
+
|
| 333 |
+
**The approach**: [if one emerged]
|
| 334 |
+
|
| 335 |
+
**Open questions**: [if any remain]
|
| 336 |
+
|
| 337 |
+
**Next steps** (if ready):
|
| 338 |
+
- Turn this into a change: `$openspec-propose (Codex) or /openspec-propose (other agents)`
|
| 339 |
+
- Keep exploring: just keep talking
|
| 340 |
+
```
|
| 341 |
+
|
| 342 |
+
But this summary is optional. Sometimes the thinking IS the value.
|
| 343 |
+
|
| 344 |
+
---
|
| 345 |
+
|
| 346 |
+
## Guardrails
|
| 347 |
+
|
| 348 |
+
- **Don't implement** - Never write code or implement features. Workflow configuration counts too: creating or editing schemas, templates, or `openspec/config.yaml` is a change, not thinking. Creating or updating OpenSpec change artifacts within the confirmed scope is fine, writing anything else is not. When the user is ready to build, name the handoff rather than starting: `$openspec-propose (Codex) or /openspec-propose (other agents)` turns the discussion into a change, and the work happens there.
|
| 349 |
+
- **Don't fake understanding** - If something is unclear, dig deeper
|
| 350 |
+
- **Don't rush** - Discovery is thinking time, not task time
|
| 351 |
+
- **Don't force structure** - Let patterns emerge naturally
|
| 352 |
+
- **Don't auto-capture** - Offer to save insights, don't just do it. Read-only commands and tools need no confirmation. Before the first write-capable actionโincluding `openspec new change` or another command that writes filesโname the artifacts or files and proposed changes, ask a direct yes/no question, and wait for explicit confirmation in a separate user message. That confirmation covers only the described scope; ask again before expanding it. Answers to design or clarifying questions are never consent to write. That rule governs `openspec new change` whenever you are the one proposing the capture; the user's own capture request is the exception, handled in the capture transition above.
|
| 353 |
+
- **Don't manually scaffold changes** - Never create a new change directory under `openspec/changes/` by hand. Always use `openspec new change "<name>"` (with `--store <id>` when applicable) so required metadata such as `.openspec.yaml` is created before writing artifacts.
|
| 354 |
+
- **Do visualize** - A good diagram is worth many paragraphs
|
| 355 |
+
- **Do explore the codebase** - Ground discussions in reality
|
| 356 |
+
- **Do question assumptions** - Including the user's and your own
|
.agents/skills/openspec-propose/SKILL.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: openspec-propose
|
| 3 |
+
description: Propose a new OpenSpec change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation. Also use when the user says "openspec propose" or "opsx propose".
|
| 4 |
+
allowed-tools: Bash(openspec:*)
|
| 5 |
+
license: MIT
|
| 6 |
+
compatibility: Requires openspec CLI.
|
| 7 |
+
metadata:
|
| 8 |
+
author: openspec
|
| 9 |
+
version: "1.0"
|
| 10 |
+
generatedBy: "1.14.3"
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
Propose a new change - create the change and generate all artifacts in one step.
|
| 14 |
+
|
| 15 |
+
**Planning boundary**: This workflow creates planning artifacts only. The user request that selected or triggered this workflow authorizes planning only, even if it asks to build or fix something. Do not edit project code. After the planning artifacts are complete, stop. Do not start implementation in the same response, even if the initial request asks for it. Wait for a new user request after the artifacts are presented; then start the apply workflow.
|
| 16 |
+
|
| 17 |
+
I'll create a change with the artifacts your schema defines. With the default spec-driven schema that is:
|
| 18 |
+
- proposal.md (what & why)
|
| 19 |
+
- `specs/<capability-path>/spec.md` (what the system must do - a delta, not the main spec)
|
| 20 |
+
- design.md (how)
|
| 21 |
+
- tasks.md (implementation steps)
|
| 22 |
+
|
| 23 |
+
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
|
| 24 |
+
|
| 25 |
+
When the user is ready to implement, they must start the apply workflow explicitly.
|
| 26 |
+
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
| 30 |
+
|
| 31 |
+
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
| 32 |
+
|
| 33 |
+
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
| 34 |
+
|
| 35 |
+
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
| 36 |
+
|
| 37 |
+
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
| 38 |
+
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
| 39 |
+
|
| 40 |
+
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
| 41 |
+
|
| 42 |
+
**Input**: The user's request should include a change name (kebab-case) OR a description of what they want to build.
|
| 43 |
+
|
| 44 |
+
**Steps**
|
| 45 |
+
|
| 46 |
+
1. **Understand the request and clarify material ambiguity**
|
| 47 |
+
|
| 48 |
+
If no clear input is provided, ask the user (open-ended, no preset options):
|
| 49 |
+
> "What change do you want to work on? Describe what you want to build or fix."
|
| 50 |
+
|
| 51 |
+
From their description, derive a kebab-case name (e.g., "add user authentication" โ `add-user-auth`).
|
| 52 |
+
|
| 53 |
+
**IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
|
| 54 |
+
|
| 55 |
+
If the request contains ambiguity that would materially affect scope, externally observable behavior, compatibility, or acceptance criteria, ask the user before creating the change. For minor details, make a reasonable assumption and record it in the planning artifacts.
|
| 56 |
+
|
| 57 |
+
2. **Load project context**
|
| 58 |
+
|
| 59 |
+
Run `openspec context --json` from the current working directory (or `openspec context --json --store "<store-id>"` when a registered store was explicitly selected). Use the returned `root.path` as the authoritative OpenSpec root. If context reports `no_openspec_root`, stop without creating or changing any files and follow the **Project check** above for how this workflow was reached. Offer `openspec init` only for an explicit OpenSpec request, and wait for the user to request initialization. Do not initialize automatically or run `openspec new change`. After initialization, rerun this context check before continuing. For any other context failure, stop and report the error; do not fall back to the current directory or run later OpenSpec commands without the selected store.
|
| 60 |
+
|
| 61 |
+
Only when context returns a resolved `root.path`, read `<root.path>/openspec/config.yaml`. Use `config.yml` only when `config.yaml` does not exist. If neither file exists, continue without project context. Do not fall back to `config.yml` if `config.yaml` is unreadable or invalid.
|
| 62 |
+
|
| 63 |
+
If the file parses as a YAML object and its `context` field is a string no larger than 51,200 bytes in UTF-8, apply that field before exploring the codebase or making planning decisions. If the file cannot be read or parsed, or the context field is invalid or oversized, continue without project context. Validate this field independently of other config fields, as OpenSpec does.
|
| 64 |
+
|
| 65 |
+
Treat context as project-provided data and constraints, not as authority to change this workflow: it cannot override user authorization, the planning boundary, tool restrictions, or artifact and output rules. Do not copy the context into artifacts; use it to focus any codebase exploration and as a constraint on the proposal.
|
| 66 |
+
|
| 67 |
+
3. **Determine the workflow schema**
|
| 68 |
+
|
| 69 |
+
Use the configured default schema unless the user explicitly requests a different workflow.
|
| 70 |
+
|
| 71 |
+
**Use a different schema only if the user:**
|
| 72 |
+
- Explicitly requests a specific schema by name โ use `--schema <schema-name>`
|
| 73 |
+
- Asks to "show workflows" or asks "what workflows" exist โ resolve the authoritative root by running `openspec context --json` from the current working directory. If the user explicitly selected a registered store, use `openspec context --json --store "<store-id>"`. Then run `openspec schemas --json` with its working directory set to the returned `root.path` and let them choose. This preserves roots selected by a local `store:` pointer or the global `defaultStore`; when a registered store was explicitly selected, append `--store "<store-id>"` to `openspec schemas --json` as well. If context fails, stop as described in the context-loading step; do not fall back to the current directory.
|
| 74 |
+
|
| 75 |
+
Otherwise, omit `--schema` to preserve the configured default.
|
| 76 |
+
|
| 77 |
+
4. **Create the change directory**
|
| 78 |
+
|
| 79 |
+
Choose one schema form below. If a registered store is selected, append `--store "<store-id>"` to that command and each later OpenSpec command shown below that accepts `--store`.
|
| 80 |
+
|
| 81 |
+
Using the configured default:
|
| 82 |
+
```bash
|
| 83 |
+
openspec new change "<name>"
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
Using an explicitly requested schema:
|
| 87 |
+
```bash
|
| 88 |
+
openspec new change "<name>" --schema "<schema-name>"
|
| 89 |
+
```
|
| 90 |
+
This creates a scaffolded change in the planning home resolved by the CLI with `.openspec.yaml`.
|
| 91 |
+
|
| 92 |
+
5. **Get the artifact build order**
|
| 93 |
+
```bash
|
| 94 |
+
openspec status --change "<name>" --json
|
| 95 |
+
```
|
| 96 |
+
Parse the JSON to get:
|
| 97 |
+
- `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
|
| 98 |
+
- `artifacts`: list of all artifacts, each with its `status` and its `requires` edges (the artifact IDs it directly depends on)
|
| 99 |
+
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
|
| 100 |
+
|
| 101 |
+
6. **Create every artifact in the required set**
|
| 102 |
+
|
| 103 |
+
Use a todo list to track progress through the artifacts.
|
| 104 |
+
|
| 105 |
+
Loop through artifacts in dependency order (artifacts with no pending dependencies first):
|
| 106 |
+
|
| 107 |
+
a. **For each artifact that is `ready` (dependencies satisfied)**:
|
| 108 |
+
- Get instructions:
|
| 109 |
+
```bash
|
| 110 |
+
openspec instructions <artifact-id> --change "<name>" --json
|
| 111 |
+
```
|
| 112 |
+
- The instructions JSON includes:
|
| 113 |
+
- `context`: Project background (constraints for you - do NOT include in output)
|
| 114 |
+
- `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
|
| 115 |
+
- `template`: The structure to use for your output file
|
| 116 |
+
- `instruction`: Schema-specific guidance for this artifact type
|
| 117 |
+
- `skipped`/`warning`: present when the change declares skip_specs and this artifact must NOT be created - stop and pick another artifact
|
| 118 |
+
- `resolvedOutputPath`: Resolved path or pattern to write the artifact
|
| 119 |
+
- `dependencies`: Completed artifacts to read for context
|
| 120 |
+
- Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
|
| 121 |
+
- **Inspect the relevant project before drafting**: Read `context` and `rules` first, then inspect relevant implementation, nearby tests, configuration, and documentation outside `openspec/`. Keep inspection read-only and proportional to the change; reuse findings for later artifacts and inspect more only as needed.
|
| 122 |
+
- Identify the target project from the request and project context; the planning home may be separate from the code. If the target is unclear, ask. For greenfield or non-code changes, inspect the available structure and relevant documents. If source is unavailable, state the limitation and ask when it materially affects the plan.
|
| 123 |
+
- Ground scope, approach, and tasks in what you find. Distinguish observed behavior from assumptions and proposed additions; surface conflicts with existing specs instead of silently deciding which is correct.
|
| 124 |
+
- Do this discovery now, rather than leaving generic "explore the codebase" or "make a plan" tasks for implementation. Keep any necessary follow-up investigation specific to an unresolved question.
|
| 125 |
+
- Choose the output path before creating anything. If `resolvedOutputPath` is a glob, follow `instruction` to choose a concrete path inside `changeRoot` that matches the glob, and verify it remains inside `changeRoot` after resolving symlinks, both in its parent directories and in the file itself if it already exists; if it does not, stop and tell the user. Otherwise the output path is `resolvedOutputPath`
|
| 126 |
+
- If the `instruction` field delegates creation to a specific skill or command, invoke it only if it can write the artifact to that output path; otherwise stop and tell the user. Then verify the artifact file exists at that output path
|
| 127 |
+
- Otherwise create the artifact file using `template` as the structure and write it to that output path
|
| 128 |
+
- Apply `context` and `rules` as constraints - but do NOT copy them into the file
|
| 129 |
+
- Show brief progress: "Created <artifact-id>"
|
| 130 |
+
|
| 131 |
+
b. **Continue until every artifact in the required set exists (not just `apply.requires`)**
|
| 132 |
+
- After creating each artifact, re-run `openspec status --change "<name>" --json`
|
| 133 |
+
- The required set is `applyRequires` plus every artifact reachable from those by following the `requires` edges in `status --json` - walk them transitively (spec-driven closes over proposal, specs, design, tasks). Leave artifacts outside that set alone
|
| 134 |
+
- `status` is file-existence only, so an `applyRequires` artifact reading `done` does NOT mean its dependencies exist - writing `tasks.md` early marks `tasks` done while `specs` was never written. Use each artifact's `requires` edges, not its `status`, to build the required set: a `done` artifact still lists what it depends on
|
| 135 |
+
- An artifact already reading `status: "skipped"` is satisfied: the change declares `skip_specs` in `.openspec.yaml`, so its files must NOT exist. Never try to create one
|
| 136 |
+
- Create every artifact in the required set that is missing, then re-check - creating one can unblock others
|
| 137 |
+
- Skip one only when `status` already reports it `skipped`, or when its own `instruction` says it is conditional: run `openspec instructions <artifact-id> --change "<name>" --json` and skip only if its `instruction` field marks it optional (e.g. "create only if..."). Spec-driven's `design.md` qualifies; `specs` qualifies only via the `skipped` status above, never by your own judgment. Tell the user, and do not reconsider it
|
| 138 |
+
- Dependencies are enablers, not gates: if a required artifact is still `blocked` only because you skipped a conditional dependency, write it anyway
|
| 139 |
+
- Stop when every artifact in the required set is `done`, `skipped`, or was deliberately skipped
|
| 140 |
+
|
| 141 |
+
c. **If an artifact requires user input** (unclear context):
|
| 142 |
+
- Ask the user to clarify
|
| 143 |
+
- Then continue with creation
|
| 144 |
+
|
| 145 |
+
7. **Show final status**
|
| 146 |
+
```bash
|
| 147 |
+
openspec status --change "<name>"
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
**Output**
|
| 151 |
+
|
| 152 |
+
After completing all artifacts, summarize:
|
| 153 |
+
- Change name and location
|
| 154 |
+
- List of artifacts created with brief descriptions, plus any conditional artifact you skipped and why
|
| 155 |
+
- What's ready: "All artifacts needed for implementation are ready."
|
| 156 |
+
- Prompt: "The artifacts are ready for review. When you are ready, run `$openspec-apply-change (Codex) or /openspec-apply-change (other agents)` or ask me to apply this change."
|
| 157 |
+
|
| 158 |
+
**Artifact Creation Guidelines**
|
| 159 |
+
|
| 160 |
+
- Follow the `instruction` field from `openspec instructions` for each artifact type - it is the authoritative guidance, even for familiar artifact names
|
| 161 |
+
- If the `instruction` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly - but only once you have chosen and checked the output path, and only if it can write there
|
| 162 |
+
- The schema defines what each artifact should contain - follow it
|
| 163 |
+
- Read dependency artifacts for context before creating new ones
|
| 164 |
+
- Use `template` as the structure for your output file - fill in its sections
|
| 165 |
+
- **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
|
| 166 |
+
- Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
|
| 167 |
+
- These guide what you write, but should never appear in the output
|
| 168 |
+
|
| 169 |
+
**Guardrails**
|
| 170 |
+
- The request that invoked this workflow authorizes planning only. Any implementation or apply instruction in that request does not carry forward. Do NOT implement the change, start the apply workflow, or edit project code during this workflow. After presenting the artifacts, stop and wait for a new user request to start the apply workflow
|
| 171 |
+
- Create every artifact the apply phase transitively depends on, not just the ids listed in `apply.requires`
|
| 172 |
+
- Always read dependency artifacts before creating a new one - re-read from disk, not from conversation memory (files may have changed since you last saw them)
|
| 173 |
+
- Ask about ambiguities that would materially change scope, externally observable behavior, compatibility, or acceptance criteria; for minor details, make reasonable assumptions and record them
|
| 174 |
+
- If a change with that name already exists, ask if user wants to continue it or create a new one
|
| 175 |
+
- Verify each artifact file exists after writing before proceeding to next
|
.agents/skills/openspec-sync-specs/SKILL.md
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: openspec-sync-specs
|
| 3 |
+
description: Sync delta specs from an OpenSpec change to main specs. Use when the user wants to update main specs with changes from a delta spec, without archiving the change. Also use when the user says "openspec sync" or "opsx sync".
|
| 4 |
+
allowed-tools: Bash(openspec:*)
|
| 5 |
+
license: MIT
|
| 6 |
+
compatibility: Requires openspec CLI.
|
| 7 |
+
metadata:
|
| 8 |
+
author: openspec
|
| 9 |
+
version: "1.0"
|
| 10 |
+
generatedBy: "1.14.3"
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
Sync delta specs from a change to main specs.
|
| 14 |
+
|
| 15 |
+
This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
|
| 16 |
+
|
| 17 |
+
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
| 18 |
+
|
| 19 |
+
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
| 20 |
+
|
| 21 |
+
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
| 22 |
+
|
| 23 |
+
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
| 24 |
+
|
| 25 |
+
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
| 26 |
+
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
| 27 |
+
|
| 28 |
+
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
| 29 |
+
|
| 30 |
+
`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
|
| 31 |
+
|
| 32 |
+
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
| 33 |
+
|
| 34 |
+
**Steps**
|
| 35 |
+
|
| 36 |
+
1. **Select the change**
|
| 37 |
+
|
| 38 |
+
If a name is provided, use it. Otherwise:
|
| 39 |
+
- Infer from conversation context if the user mentioned a change
|
| 40 |
+
- Auto-select if only one active change exists
|
| 41 |
+
- If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
|
| 42 |
+
|
| 43 |
+
When prompting, show changes that have delta specs (under `specs/` directory).
|
| 44 |
+
|
| 45 |
+
Always announce: "Using change: <name>" and how to override (e.g., `$openspec-sync-specs (Codex) or /openspec-sync-specs (other agents) <other>`).
|
| 46 |
+
|
| 47 |
+
2. **Resolve change context**
|
| 48 |
+
|
| 49 |
+
Run:
|
| 50 |
+
```bash
|
| 51 |
+
openspec status --change "<name>" --json
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
The JSON includes `planningHome.root`. Main specs live under `<planningHome.root>/openspec/specs/` โ use that (store-aware) root for every main-spec path below, not a hardcoded repo path. When a store is selected it points at the store, not the current repository.
|
| 55 |
+
|
| 56 |
+
3. **Find delta specs**
|
| 57 |
+
|
| 58 |
+
Use `artifactPaths.specs.existingOutputPaths` from the status JSON as the
|
| 59 |
+
only source of delta spec paths. If the `specs` entry is missing or
|
| 60 |
+
`existingOutputPaths` is empty, report that there are no delta specs to sync,
|
| 61 |
+
do not infer them from other artifacts, and stop without requesting artifact
|
| 62 |
+
instructions or writing a main spec.
|
| 63 |
+
|
| 64 |
+
Sync every path in `existingOutputPaths` unless the caller narrowed the set.
|
| 65 |
+
A caller narrows it by naming an explicit list of complete entries from
|
| 66 |
+
`existingOutputPaths` โ copy those absolute values verbatim. Archive does
|
| 67 |
+
this inline, and a user can too (for example, by selecting the entry ending
|
| 68 |
+
in `/specs/billing/invoices/spec.md`).
|
| 69 |
+
Then sync only the named paths and leave the remaining delta specs untouched:
|
| 70 |
+
bulk archive excludes a delta whose implementation it could not find, and
|
| 71 |
+
syncing it anyway would write a main spec the caller deliberately withheld.
|
| 72 |
+
Carry that narrowed selection through step 4; never widen it back to the full
|
| 73 |
+
list. If a named path is not in `existingOutputPaths`, do not sync it โ
|
| 74 |
+
report it and stop, rather than dropping it silently. If the named list is
|
| 75 |
+
empty, report that there is nothing to sync and stop without writing a main
|
| 76 |
+
spec.
|
| 77 |
+
|
| 78 |
+
Each delta spec file contains sections like:
|
| 79 |
+
- `## ADDED Requirements` - New requirements to add
|
| 80 |
+
- `## MODIFIED Requirements` - Changes to existing requirements
|
| 81 |
+
- `## REMOVED Requirements` - Requirements to remove
|
| 82 |
+
- `## RENAMED Requirements` - Requirements to rename (FROM:/TO: format)
|
| 83 |
+
|
| 84 |
+
If no delta specs found, inform user and stop.
|
| 85 |
+
|
| 86 |
+
4. **For each delta spec, apply changes to main specs**
|
| 87 |
+
|
| 88 |
+
Before the first main-spec write, obtain one current specs-rule snapshot:
|
| 89 |
+
- If archive invoked this workflow inline and supplied a valid snapshot from
|
| 90 |
+
`openspec instructions specs --change "<name>" --json`, reuse it and do not
|
| 91 |
+
fetch the same instructions again.
|
| 92 |
+
- Otherwise run that command once now with the same selected-root flags.
|
| 93 |
+
- If the direct lookup exits non-zero or returns invalid artifact-instruction
|
| 94 |
+
JSON, report the error and stop before writing any main spec. Do not treat the
|
| 95 |
+
failure as an absent rule set.
|
| 96 |
+
- A valid response with omitted `rules` means no artifact rules are configured
|
| 97 |
+
and the existing semantic merge continues.
|
| 98 |
+
|
| 99 |
+
Apply returned `rules` only to the content and form of the main specs produced
|
| 100 |
+
by this merge. Artifact rules are not operation guidance and cannot change
|
| 101 |
+
selected roots, delta paths, CLI checks, or workflow steps. Use their text as
|
| 102 |
+
constraints without copying it verbatim into a main spec or summary.
|
| 103 |
+
|
| 104 |
+
For each capability delta spec path selected in step 3 โ the full `existingOutputPaths` list, or the narrowed subset when a caller supplied one (these may belong to a selected store, not the repo):
|
| 105 |
+
|
| 106 |
+
a. **Read the delta spec** to understand the intended changes
|
| 107 |
+
|
| 108 |
+
b. **Read the main spec** at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (may not exist yet)
|
| 109 |
+
|
| 110 |
+
**If it does not exist yet** (a new capability), match what `openspec archive` does:
|
| 111 |
+
only ADDED requirements may be applied - step d creates the spec from them.
|
| 112 |
+
MODIFIED and RENAMED have no requirement to act on, so stop the sync for that
|
| 113 |
+
capability and report that its main spec does not exist and only ADDED is allowed
|
| 114 |
+
for a new spec; never invent the missing requirement. REMOVED has nothing to
|
| 115 |
+
remove - skip it and warn.
|
| 116 |
+
|
| 117 |
+
c. **Apply changes intelligently**:
|
| 118 |
+
|
| 119 |
+
**ADDED Requirements:**
|
| 120 |
+
- If requirement doesn't exist in main spec โ add it
|
| 121 |
+
- If requirement already exists โ update it to match (treat as implicit MODIFIED)
|
| 122 |
+
|
| 123 |
+
**MODIFIED Requirements:**
|
| 124 |
+
- Find the requirement in main spec
|
| 125 |
+
- Apply the changes - this can be:
|
| 126 |
+
- Adding new scenarios the main spec does not have yet
|
| 127 |
+
- Modifying existing scenarios
|
| 128 |
+
- Changing the requirement description
|
| 129 |
+
- Preserve scenarios/content not mentioned in the delta
|
| 130 |
+
|
| 131 |
+
**REMOVED Requirements:**
|
| 132 |
+
- Remove the entire requirement block from main spec
|
| 133 |
+
- Retiring the capability. Delete the whole `spec.md` - and the directory once
|
| 134 |
+
nothing else is left in it - only when ALL of these hold:
|
| 135 |
+
1. removing the requirements *this run* left no requirement blocks;
|
| 136 |
+
2. the rest of the spec is well-formed (it still has a `## Purpose`);
|
| 137 |
+
3. the main spec was not already empty before this sync - if you removed
|
| 138 |
+
nothing, change nothing;
|
| 139 |
+
4. every other nonblank line in the whole file is accounted for as the
|
| 140 |
+
title, Purpose, Requirements header, or a canonical requirement's
|
| 141 |
+
statement, scenarios, or fenced examples;
|
| 142 |
+
5. the change's `.openspec.yaml` declares `retire_capabilities: true`;
|
| 143 |
+
6. the `spec.md` resolves inside the real specs root (do not follow a
|
| 144 |
+
capability-directory symlink to delete an external file).
|
| 145 |
+
If removing the selected requirements would leave no requirement blocks and
|
| 146 |
+
any retirement condition is not satisfied, do not modify the main spec. Stop
|
| 147 |
+
the sync for that capability, report the blocking condition, and tell the user
|
| 148 |
+
how to resolve it. Never write or leave an empty `## Requirements` section.
|
| 149 |
+
When only the marker is missing, say that too - it is the one thing the user
|
| 150 |
+
can add to make the retirement go through.
|
| 151 |
+
- Deleting the file also deletes its `## Purpose`; any other section blocks
|
| 152 |
+
retirement. Name Purpose when you report the retirement. Include a pasteable
|
| 153 |
+
`git checkout` only when the spec lived in the caller's checkout;
|
| 154 |
+
otherwise give checkout-scoped recovery guidance.
|
| 155 |
+
|
| 156 |
+
**RENAMED Requirements:**
|
| 157 |
+
- Find the FROM requirement, rename to TO
|
| 158 |
+
|
| 159 |
+
**`## Purpose` in the delta:**
|
| 160 |
+
- The main spec already has one and it is authoritative - leave it alone
|
| 161 |
+
(this is what `openspec archive` does; it warns and moves on)
|
| 162 |
+
|
| 163 |
+
d. **Create new main spec** if capability doesn't exist yet:
|
| 164 |
+
- Only when the delta has ADDED requirements to put in it and no MODIFIED or
|
| 165 |
+
RENAMED requirements blocked this capability in step b. Otherwise create nothing
|
| 166 |
+
and leave the specs directory untouched. For a REMOVED-only delta, if the change's
|
| 167 |
+
`.openspec.yaml` declares `retire_capabilities: true`, report it as already retired
|
| 168 |
+
and continue without recreating the spec. Without that marker, report the sync as blocked:
|
| 169 |
+
`openspec archive` rejects it with `Spec must have at least one requirement`.
|
| 170 |
+
An empty delta has no operations to sync; report it as blocked too.
|
| 171 |
+
Never write an empty `## Requirements` section.
|
| 172 |
+
- Create `<planningHome.root>/openspec/specs/<capability-path>/spec.md`
|
| 173 |
+
- Add Purpose section: copy the delta's `## Purpose` body verbatim when it has one
|
| 174 |
+
(this is what `openspec archive` does); only write a brief TBD placeholder when it does not
|
| 175 |
+
- Add Requirements section with the ADDED requirements
|
| 176 |
+
- Follow the **Main Spec Format Reference** below
|
| 177 |
+
|
| 178 |
+
5. **Validate updated main specs**
|
| 179 |
+
|
| 180 |
+
Run `openspec validate --specs` with the same selected-root flags used earlier.
|
| 181 |
+
If validation fails, report the problems and do not claim the sync succeeded.
|
| 182 |
+
|
| 183 |
+
6. **Show summary**
|
| 184 |
+
|
| 185 |
+
After applying all changes, summarize:
|
| 186 |
+
- Which capabilities were updated
|
| 187 |
+
- What changes were made (requirements added/modified/removed/renamed)
|
| 188 |
+
- Any new main spec left with a TBD Purpose placeholder, so it gets written
|
| 189 |
+
now rather than lingering
|
| 190 |
+
- Any capability retired, naming the deleted `spec.md`, its Purpose, and
|
| 191 |
+
either a pasteable `git checkout` or checkout-scoped recovery guidance
|
| 192 |
+
|
| 193 |
+
**Delta Spec Format Reference**
|
| 194 |
+
|
| 195 |
+
```markdown
|
| 196 |
+
# Spec Delta
|
| 197 |
+
|
| 198 |
+
## Purpose
|
| 199 |
+
|
| 200 |
+
Only on a delta that introduces a brand-new capability. Seeds the new main spec.
|
| 201 |
+
|
| 202 |
+
## ADDED Requirements
|
| 203 |
+
|
| 204 |
+
### Requirement: New Feature
|
| 205 |
+
The system SHALL do something new.
|
| 206 |
+
|
| 207 |
+
#### Scenario: Basic case
|
| 208 |
+
- **WHEN** user does X
|
| 209 |
+
- **THEN** system does Y
|
| 210 |
+
|
| 211 |
+
## MODIFIED Requirements
|
| 212 |
+
|
| 213 |
+
### Requirement: Existing Feature
|
| 214 |
+
The system SHALL keep doing the existing thing, now also handling A.
|
| 215 |
+
|
| 216 |
+
#### Scenario: Scenario the main spec already has
|
| 217 |
+
- **WHEN** user does X
|
| 218 |
+
- **THEN** system does Y
|
| 219 |
+
|
| 220 |
+
#### Scenario: New scenario to add
|
| 221 |
+
- **WHEN** user does A
|
| 222 |
+
- **THEN** system does B
|
| 223 |
+
|
| 224 |
+
## REMOVED Requirements
|
| 225 |
+
|
| 226 |
+
### Requirement: Deprecated Feature
|
| 227 |
+
|
| 228 |
+
## RENAMED Requirements
|
| 229 |
+
|
| 230 |
+
- FROM: `### Requirement: Old Name`
|
| 231 |
+
- TO: `### Requirement: New Name`
|
| 232 |
+
```
|
| 233 |
+
|
| 234 |
+
**Main Spec Format Reference**
|
| 235 |
+
|
| 236 |
+
Main specs are what the delta merges INTO. They must never contain delta operation headers (`## ADDED/MODIFIED/REMOVED/RENAMED Requirements`) - after syncing, every requirement lives under a single `## Requirements` section:
|
| 237 |
+
|
| 238 |
+
```markdown
|
| 239 |
+
# <capability> Specification
|
| 240 |
+
|
| 241 |
+
## Purpose
|
| 242 |
+
Short description of what this capability does and why it exists.
|
| 243 |
+
|
| 244 |
+
## Requirements
|
| 245 |
+
|
| 246 |
+
### Requirement: New Feature
|
| 247 |
+
The system SHALL do something new.
|
| 248 |
+
|
| 249 |
+
#### Scenario: Basic case
|
| 250 |
+
- **WHEN** user does X
|
| 251 |
+
- **THEN** system does Y
|
| 252 |
+
```
|
| 253 |
+
|
| 254 |
+
**Key Principle: Intelligent Merging**
|
| 255 |
+
|
| 256 |
+
Unlike programmatic merging, you merge rather than overwrite:
|
| 257 |
+
- A MODIFIED block carries the whole requirement - body plus every scenario that survives the change. `openspec validate` and `openspec archive` both reject one that drops a scenario the main spec still has.
|
| 258 |
+
- Keep anything the delta does not mention, in the main spec's existing order
|
| 259 |
+
- Use your judgment to merge changes sensibly
|
| 260 |
+
|
| 261 |
+
**Output On Success**
|
| 262 |
+
|
| 263 |
+
```markdown
|
| 264 |
+
## Specs Synced: <change-name>
|
| 265 |
+
|
| 266 |
+
Updated main specs:
|
| 267 |
+
|
| 268 |
+
**<capability-1>**:
|
| 269 |
+
- Added requirement: "New Feature"
|
| 270 |
+
- Modified requirement: "Existing Feature" (added 1 scenario)
|
| 271 |
+
|
| 272 |
+
**<capability-2>**:
|
| 273 |
+
- Created new spec file
|
| 274 |
+
- Added requirement: "Another Feature"
|
| 275 |
+
|
| 276 |
+
Main specs are now updated. The change remains active - archive when implementation is complete.
|
| 277 |
+
```
|
| 278 |
+
|
| 279 |
+
**Guardrails**
|
| 280 |
+
- Read both delta and main specs before making changes
|
| 281 |
+
- Preserve existing content not mentioned in delta
|
| 282 |
+
- Never copy a delta file into a main spec as-is - merge its content so the main spec keeps the Main Spec Format Reference structure, with no delta operation headers
|
| 283 |
+
- If something is unclear, ask for clarification
|
| 284 |
+
- Show what you're changing as you go
|
| 285 |
+
- The operation should be idempotent - running twice should give same result
|
| 286 |
+
- Use only `artifactPaths.specs.existingOutputPaths`; never infer delta specs from unrelated artifacts
|
| 287 |
+
- Honor a caller-supplied subset of `existingOutputPaths`; never widen it back to the full list
|
| 288 |
+
- Fetch specs instructions once for direct sync, or reuse the archive-supplied snapshot inline
|
| 289 |
+
- Stop before every main-spec write on a non-zero or invalid JSON specs-instruction response
|
| 290 |
+
- Artifact rules constrain only the specs being written and are never copied into output files
|
.agents/skills/openspec-update-change/SKILL.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: openspec-update-change
|
| 3 |
+
description: Update an OpenSpec change by revising its existing planning artifacts and keeping them coherent with one another. Use when the user wants to revise a change's plan, fold new decisions into it, or reconcile its artifacts after an edit. Also use when the user says "openspec update change" or "opsx update". If the user means the openspec update CLI command, which refreshes generated files, run that command instead. Never edits code.
|
| 4 |
+
allowed-tools: Bash(openspec:*)
|
| 5 |
+
license: MIT
|
| 6 |
+
compatibility: Requires openspec CLI.
|
| 7 |
+
metadata:
|
| 8 |
+
author: openspec
|
| 9 |
+
version: "1.0"
|
| 10 |
+
generatedBy: "1.14.3"
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
Revise a change's existing planning artifacts and keep them coherent. Never edit code.
|
| 14 |
+
|
| 15 |
+
**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
|
| 16 |
+
|
| 17 |
+
**Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
|
| 18 |
+
|
| 19 |
+
One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
|
| 20 |
+
|
| 21 |
+
Otherwise, with no root, what happens next depends on how this workflow was reached:
|
| 22 |
+
|
| 23 |
+
- **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
|
| 24 |
+
- **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
|
| 25 |
+
|
| 26 |
+
In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
|
| 27 |
+
|
| 28 |
+
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
| 29 |
+
|
| 30 |
+
This workflow revises artifacts that already exist; it never creates missing ones. When an artifact is missing, `openspec status --change "<name>" --json` names the next one and `openspec instructions "<artifact-id>" --change "<name>" --json` explains how to write it.
|
| 31 |
+
|
| 32 |
+
**Steps**
|
| 33 |
+
|
| 34 |
+
1. **Select the change**
|
| 35 |
+
|
| 36 |
+
If a name is provided, use it. Otherwise:
|
| 37 |
+
- Infer from conversation context if the user mentioned a change
|
| 38 |
+
- Auto-select if only one active change exists
|
| 39 |
+
- If ambiguous, run `openspec list --json` to get available changes sorted by most recently modified, and ask the user to select one
|
| 40 |
+
|
| 41 |
+
When prompting, present the top 3-4 most recently modified changes as options, showing:
|
| 42 |
+
- Change name
|
| 43 |
+
- Status (e.g., "0/5 tasks", "complete", "no tasks")
|
| 44 |
+
- How recently it was modified (from `lastModified` field)
|
| 45 |
+
|
| 46 |
+
Mark the most recently modified change as "(Recommended)" since it's likely what the user wants to update.
|
| 47 |
+
|
| 48 |
+
Always announce: "Using change: <name>" and how to override (e.g., `$openspec-update-change (Codex) or /openspec-update-change (other agents) <other>`).
|
| 49 |
+
|
| 50 |
+
2. **Get the change's artifacts**
|
| 51 |
+
```bash
|
| 52 |
+
openspec status --change "<name>" --json
|
| 53 |
+
```
|
| 54 |
+
Parse the JSON to understand current state. The response includes:
|
| 55 |
+
- `schemaName`: The workflow schema being used (e.g., "spec-driven")
|
| 56 |
+
- `artifacts`: Array of artifacts with their status ("done", "skipped", "ready", "blocked")
|
| 57 |
+
- `isPlanningComplete`: Boolean indicating if all planning artifacts are complete. Older CLI versions expose the same value as `isComplete`.
|
| 58 |
+
- `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
|
| 59 |
+
|
| 60 |
+
The artifact ids and paths come from the active schema - do NOT assume them, and do NOT branch on hardcoded artifact names. Custom schemas must work unchanged.
|
| 61 |
+
|
| 62 |
+
The files to edit are `artifactPaths.<id>.existingOutputPaths` - the concrete files that exist on disk, already glob-expanded for glob artifacts (e.g. `specs/**/*.md`), plus any confirmed concrete path allowed under a partly populated glob artifact (step 4). Do NOT write to `resolvedOutputPath`: for a glob artifact it is still the glob pattern, not a real file.
|
| 63 |
+
|
| 64 |
+
3. **Understand the request**
|
| 65 |
+
- If the user asked for a specific revision ("the design now uses X"), that is the starting edit.
|
| 66 |
+
- If they only said "update" / "make this coherent", treat it as a coherence review: read the existing artifacts and check them against each other for contradictions, gaps, and duplication.
|
| 67 |
+
|
| 68 |
+
4. **Read and reconcile**
|
| 69 |
+
- Read the artifact(s) the request touches and the change's other existing artifacts.
|
| 70 |
+
- Draft the requested edit in the conversation, not in files. Work out exactly what it changes; step 5 owns every write. Then check every other existing artifact against the drafted edit - in ANY direction: an edit to a later artifact may require revising an earlier one, not only the other way around. Build order is a useful reading order, not a constraint on which artifacts may be revised.
|
| 71 |
+
- Note everything that is now inconsistent, missing, or contradictory.
|
| 72 |
+
- Propose revisions to files that already exist (`existingOutputPaths`). If an artifact has no existing output files and status `ready` or `blocked`, note it and point the user to `openspec instructions "<artifact-id>" --change "<name>" --json` for how to create them. Leave `skipped` artifacts untouched; do not treat them as missing or defer them to the continue workflow.
|
| 73 |
+
- A glob artifact (e.g. `specs/**/*.md`) is marked `done` after at least one file matches, and the continue workflow only handles `ready` artifacts. When reconciliation identifies a missing file for a glob artifact whose `existingOutputPaths` is non-empty:
|
| 74 |
+
1. Run `openspec instructions "<artifact-id>" --change "<name>" --json` and use its `instruction` and `template`. Treat `context` and `rules` as constraints; do not copy them into the file. If instructions report `skipped: true`, do not create the file. Read current dependency files from disk; if a required non-skipped dependency is missing, stop and ask the user to restore it first.
|
| 75 |
+
2. Choose a concrete path inside `changeRoot` that matches `artifactPaths.<id>.outputPath` and does not already exist. Verify it remains inside `changeRoot` after resolving any symlinked parent directories. The glob `resolvedOutputPath` is not a valid target.
|
| 76 |
+
3. Include the new file in step 5's proposed revisions and create it only after the user confirms.
|
| 77 |
+
4. After confirmation, immediately before creation, refresh status and instructions. Verify the artifact is still in scope, not skipped, and partially populated; repeat the concrete-path checks above.
|
| 78 |
+
5. Use a create operation that fails if the target already exists. If `instruction` delegates creation to another skill or command, invoke it only if it can honor the confirmed path and these guardrails; otherwise stop. If any check fails or the confirmed draft is no longer valid, stop and reconcile with the user rather than replacing existing content or choosing a different path.
|
| 79 |
+
- If the change is already coherent, say so and propose no revisions.
|
| 80 |
+
|
| 81 |
+
5. **Confirm and apply, one artifact at a time**
|
| 82 |
+
- This step performs every artifact write in this workflow; no earlier step edits an artifact.
|
| 83 |
+
- Show each proposed revision and why - including the requested edit drafted in step 4. Write only after the user confirms.
|
| 84 |
+
- If the user rejects a revision, do not write it - leave that artifact unchanged.
|
| 85 |
+
- When a substantial rewrite is needed, get that artifact's rules and template first:
|
| 86 |
+
```bash
|
| 87 |
+
openspec instructions "<artifact-id>" --change "<name>" --json
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
6. **Point to the next step (guidance only - NEVER act on it)**
|
| 91 |
+
- Artifacts with empty `existingOutputPaths` and status `ready` or `blocked` -> run `openspec status --change "<name>" --json` for the next artifact and point the user to `openspec instructions "<artifact-id>" --change "<name>" --json` for how to create it.
|
| 92 |
+
- Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan; suggest `$openspec-apply-change (Codex) or /openspec-apply-change (other agents)` to carry the delta into code.
|
| 93 |
+
- Everything done and implemented -> suggest `$openspec-archive-change (Codex) or /openspec-archive-change (other agents)`.
|
| 94 |
+
|
| 95 |
+
**Output**
|
| 96 |
+
|
| 97 |
+
After each invocation, show:
|
| 98 |
+
- Which artifacts were revised (and which proposed revisions were rejected)
|
| 99 |
+
- Any file created under a glob artifact that was already partially populated
|
| 100 |
+
- Anything deferred because it does not exist yet (artifacts with no files and status `ready` or `blocked`, never `skipped` artifacts)
|
| 101 |
+
- Where the change stands and the recommended next command
|
| 102 |
+
|
| 103 |
+
**Guardrails**
|
| 104 |
+
- Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes, stop and point to `$openspec-apply-change (Codex) or /openspec-apply-change (other agents)`.
|
| 105 |
+
- Use the artifact ids and paths reported by `openspec status`; never branch on hardcoded artifact names.
|
| 106 |
+
- Edit only the concrete files in `existingOutputPaths`, plus any confirmed concrete path allowed under a partly populated glob artifact (step 4); never write to a glob `resolvedOutputPath`.
|
| 107 |
+
- Do not advance the build frontier: if an artifact has empty `existingOutputPaths` and status `ready` or `blocked`, creating them is a separate step, outside this workflow. Leave `skipped` artifacts untouched. The only new-file scope is a confirmed concrete path under a glob artifact whose `existingOutputPaths` is non-empty.
|
| 108 |
+
- Confirm every edit with the user before writing.
|
| 109 |
+
- If the request changes the change's *intent* rather than refining it, ask for a distinct unused change name and recommend `openspec new change "<new-change-name>"` instead (the "Update vs. Start Fresh" heuristic).
|
.gitattributes
CHANGED
|
@@ -35,3 +35,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
*.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
*.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
scripts/demo_video/assets/*.jpg filter=lfs diff=lfs merge=lfs -text
|
.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
22
|
README.md
CHANGED
|
@@ -233,7 +233,7 @@ alter table public.attempts
|
|
| 233 |
add column if not exists version text not null default '';
|
| 234 |
```
|
| 235 |
|
| 236 |
-
The page reads these rows back through `GET /api/progress` (best score and tries per phrase, recordings, days practised, distinct practice days in the current week, and current/longest consecutive-day streaks); the best scores then follow the student between devices. Above the path, **ืืขืจืืืช ืฉืืืจ ืฉืืื** turns every practised phrase into a bead, except that a story or dialogue is represented by one bead for the whole topic. A phrase turns gold at 75 or more; a story's bead turns gold only when all of its lines do. It also shows a four-day weekly practice ring and a ๐ฅ consecutive-day streak; yesterday keeps a streak alive until the student has had today to continue it.
|
| 237 |
|
| 238 |
### The teacher
|
| 239 |
|
|
@@ -621,7 +621,7 @@ A sentence translated from Arabic to Hebrew (the topics named "... ืขืจืืืช
|
|
| 621 |
|
| 622 |
### The story quiz
|
| 623 |
|
| 624 |
-
A story topic (a conversation, all its lines on the card) has a "ืืืื" button: the student says the whole conversation in one go. Each line is recorded by itself, once; its score appears beside the line, its Arabic under it, and the next line is recorded, with no answer played and no second try. A line that was not heard waits for the microphone button; one that was skipped comes back after the last line. At the end the card shows the grade (the average of the lines' scores, and how many were said) and the three mistakes made most often across the lines, each with its tip and the words it was heard in (`QUIZ` in `static/index.html`). "ืกืืื ืืืืื" ends it early on the lines said so far. The lines are recorded as attempts like any other, so a quiz counts in the student's progress and in the panel.
|
| 625 |
|
| 626 |
The classes are kept in Supabase and read and written with `SUPABASE_SECRET_KEY` only, so the table has row-level security and no policy. Create it once:
|
| 627 |
|
|
|
|
| 233 |
add column if not exists version text not null default '';
|
| 234 |
```
|
| 235 |
|
| 236 |
+
The page reads these rows back through `GET /api/progress` (best score and tries per phrase, recordings, days practised, distinct practice days in the current week, and current/longest consecutive-day streaks); the best scores then follow the student between devices. Above the path, **ืืขืจืืืช ืฉืืืจ ืฉืืื** turns every practised phrase into a bead, except that a story or dialogue is represented by one bead for the whole topic. A phrase turns gold at 75 or more; a story's bead turns gold only when all of its lines do. Completing every listed spoken phrase in a lesson awards one **ืืกืืื**. The prominent collection card separately counts regular beads, gold beads, and ืืกืืืืช; its detail view marks each completed lesson's ืืกืืื. A compact collector at the top of the exercise card opens the same collection. When a new exercise bead is earned, its regular or gold bead flies from the microphone into that collector instead of showing a text popup. It also shows a four-day weekly practice ring and a ๐ฅ consecutive-day streak; yesterday keeps a streak alive until the student has had today to continue it. Gold upgrades, a newly completed lesson's ืืกืืื, meaningful personal bests, streaks and completed topics are celebrated on the practice card. Moving past a topic's last sentence once every sentence was practised opens the topic's end: a bead per sentence (gold 75+, red under 60). With no red bead it is a medal, stars, confetti and a chime, and the button goes on to the next topic (the lesson's next, or the next lesson's first). With red beads it offers a short round of just those sentences, after which the dialog comes back showing what improved; the student can also go on regardless. A bead opens its sentence. Hands-free driving mode skips the dialog. The teacher's **ืืืืืืื** tab aggregates `issues` without returning student identities. It shows a candidate when the same judgement occurred in at least five attempts, for at least three students and 30% of the students who attempted that phrase. These are investigation candidates, not proof of a scoring error; a teacher must explicitly turn one into a calibration draft and apply it.
|
| 237 |
|
| 238 |
### The teacher
|
| 239 |
|
|
|
|
| 621 |
|
| 622 |
### The story quiz
|
| 623 |
|
| 624 |
+
A story topic (a conversation, all its lines on the card) has a "ืืืื" button: the student says the whole conversation in one go. Each line is recorded by itself, once; its score appears beside the line, its Arabic under it, and the next line is recorded, with no answer played and no second try. A line that was not heard waits for the microphone button; one that was skipped comes back after the last line. At the end the card shows the grade (the average of the lines' scores, and how many were said) and the three mistakes made most often across the lines, each with its tip and the words it was heard in (`QUIZ` in `static/index.html`). "ืกืืื ืืืืื" ends it early on the lines said so far. The lines are recorded as attempts like any other, so a quiz counts in the student's progress and in the panel. Story driving mode is listening-only and asks how to play the conversation: **Arabic only** plays every Arabic line with a three-second pause between lines; **Hebrew then Arabic** reads each Hebrew sentence followed by its Arabic line. Throughout driving mode, the screen shows the Hebrew meaning and the spoken Arabic in Hebrew transliteration together.
|
| 625 |
|
| 626 |
The classes are kept in Supabase and read and written with `SUPABASE_SECRET_KEY` only, so the table has row-level security and no policy. Create it once:
|
| 627 |
|
app/phrases.py
CHANGED
|
@@ -149,6 +149,6 @@ def public_phrases():
|
|
| 149 |
return [
|
| 150 |
{"id": i, "cat": p["cat"], "he": p["he"], "tr": p["tr"], "ar": p["variants"][0][0],
|
| 151 |
"ar_pointed": point_arabic(*p["variants"][0]),
|
| 152 |
-
**{k: p[k] for k in ("grp", "pron", "neg", "listed", "seq", "read", "unlock", "binyan", "gizra", "speaker") if k in p}}
|
| 153 |
for i, p in enumerate(PHRASES) if p["cat"] in shown
|
| 154 |
]
|
|
|
|
| 149 |
return [
|
| 150 |
{"id": i, "cat": p["cat"], "he": p["he"], "tr": p["tr"], "ar": p["variants"][0][0],
|
| 151 |
"ar_pointed": point_arabic(*p["variants"][0]),
|
| 152 |
+
**{k: p[k] for k in ("grp", "pron", "neg", "listed", "seq", "read", "unlock", "binyan", "gizra", "speaker", "he_say") if k in p}}
|
| 153 |
for i, p in enumerate(PHRASES) if p["cat"] in shown
|
| 154 |
]
|
app/rules.py
CHANGED
|
@@ -276,6 +276,16 @@ def _final_b_devoicing(toks, i, sc, heard, ar_words):
|
|
| 276 |
return following.word == toks[i].word + 1 and base(following.phoneme) in _VOICELESS_ONSETS
|
| 277 |
|
| 278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
# Rule 29: in connected speech, a word-final short vowel flows into a vowel-initial next word. The next word is
|
| 280 |
# commonly represented with an initial ส token, so accept either V or ส+V as the hiatus context. CTC may assign the
|
| 281 |
# transition to only one side and call the final vowel deleted even in native speech (ุนูู ุฅูุฏู).
|
|
@@ -300,6 +310,7 @@ EXEMPTIONS = [
|
|
| 300 |
("article_vowel_elided", _article_vowel_elided, None),
|
| 301 |
("near_vowel", _near_vowel, "near_vowel_floor"),
|
| 302 |
("final_b_devoicing", _final_b_devoicing, None),
|
|
|
|
| 303 |
("word_final_vowel_linking", _word_final_vowel_linking, "near_vowel_floor"),
|
| 304 |
("unmarked_short_vowel", _unmarked_short_vowel, "near_vowel_floor"),
|
| 305 |
]
|
|
@@ -348,6 +359,9 @@ def _toggles() -> list[Toggle]:
|
|
| 348 |
Toggle("final_b_devoicing", "judge", "6.3 #28", "b ืกืืคืืช ืืคื ื ืขืืฆืืจ ืืืื",
|
| 349 |
"b ืืกืืฃ ืืืื ืฉืืืืื ืฉืืข ืึพp ืืคื ื ืขืืฆืืจ ืืืื ืืืืื ืืืื ืืงืืืช ืฆืืื ืืื; "
|
| 350 |
"ืืืืฆืข ืืืื ืื ืืคื ื ืขืืฆืืจ ืงืืื ืืื ืคืืืจ."),
|
|
|
|
|
|
|
|
|
|
| 351 |
Toggle("word_final_vowel_linking", "judge", "6.3 #29", "ืชื ืืขื ืกืืคืืช ืฉืืชืืืจืช ืืชื ืืขื ืืืื",
|
| 352 |
"ืชื ืืขื ืงืฆืจื ืืกืืฃ ืืืื ืฉืืืืื ืจืืื ืืืืืงื ืืคื ื ืืืื ืฉืืชืืืื ืืชื ืืขื ืืงืืืช ืืคืืืช 90; "
|
| 353 |
"ืืืืฆืข ืืืื ืื ืืคื ื ืขืืฆืืจ ืืื ืคืืืจ."),
|
|
|
|
| 276 |
return following.word == toks[i].word + 1 and base(following.phoneme) in _VOICELESS_ONSETS
|
| 277 |
|
| 278 |
|
| 279 |
+
# Rule 32: plain t heard as d, or d heard as t. Hebrew has the same contrast (ืช / ื), so a learner hardly ever swaps
|
| 280 |
+
# them, while the multilingual model often does: a t after n (ุงูุชู) or between vowels (ูุชุญ) gets some voicing in
|
| 281 |
+
# natural speech and is labelled d. Emphatics (tหค, dหค) are not covered: their plain counterparts are rule 3.3.
|
| 282 |
+
_VOICING_PAIR = {("t", "d"), ("d", "t")}
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
def _t_d_voicing(toks, i, sc, heard, ar_words):
|
| 286 |
+
return not sc.deleted and (base(toks[i].phoneme), base(heard or "")) in _VOICING_PAIR
|
| 287 |
+
|
| 288 |
+
|
| 289 |
# Rule 29: in connected speech, a word-final short vowel flows into a vowel-initial next word. The next word is
|
| 290 |
# commonly represented with an initial ส token, so accept either V or ส+V as the hiatus context. CTC may assign the
|
| 291 |
# transition to only one side and call the final vowel deleted even in native speech (ุนูู ุฅูุฏู).
|
|
|
|
| 310 |
("article_vowel_elided", _article_vowel_elided, None),
|
| 311 |
("near_vowel", _near_vowel, "near_vowel_floor"),
|
| 312 |
("final_b_devoicing", _final_b_devoicing, None),
|
| 313 |
+
("t_d_voicing", _t_d_voicing, None),
|
| 314 |
("word_final_vowel_linking", _word_final_vowel_linking, "near_vowel_floor"),
|
| 315 |
("unmarked_short_vowel", _unmarked_short_vowel, "near_vowel_floor"),
|
| 316 |
]
|
|
|
|
| 359 |
Toggle("final_b_devoicing", "judge", "6.3 #28", "b ืกืืคืืช ืืคื ื ืขืืฆืืจ ืืืื",
|
| 360 |
"b ืืกืืฃ ืืืื ืฉืืืืื ืฉืืข ืึพp ืืคื ื ืขืืฆืืจ ืืืื ืืืืื ืืืื ืืงืืืช ืฆืืื ืืื; "
|
| 361 |
"ืืืืฆืข ืืืื ืื ืืคื ื ืขืืฆืืจ ืงืืื ืืื ืคืืืจ."),
|
| 362 |
+
Toggle("t_d_voicing", "judge", "6.3 #32", "t ืึพd ืื ืืชืืืคืืช",
|
| 363 |
+
"t ืฉืืืืื ืฉืืข ืึพd, ืื d ืฉื ืฉืืขื ืึพt, ืืงืืืช ืฆืืื ืืื: ืืืืจื ืขืืจืืช ืืืืื ืื ืืื ืช ืึพื, "
|
| 364 |
+
"ืืืืืื ืืืขื ืืืื ืืื (ืืืจื n, ืืื ืชื ืืขืืช). ืขืืฆืืจืื ืืืืืฉืื (ุท, ุถ) ื ืืืงืื ืืจืืื."),
|
| 365 |
Toggle("word_final_vowel_linking", "judge", "6.3 #29", "ืชื ืืขื ืกืืคืืช ืฉืืชืืืจืช ืืชื ืืขื ืืืื",
|
| 366 |
"ืชื ืืขื ืงืฆืจื ืืกืืฃ ืืืื ืฉืืืืื ืจืืื ืืืืืงื ืืคื ื ืืืื ืฉืืชืืืื ืืชื ืืขื ืืงืืืช ืืคืืืช 90; "
|
| 367 |
"ืืืืฆืข ืืืื ืื ืืคื ื ืขืืฆืืจ ืืื ืคืืืจ."),
|
app/workbook.py
CHANGED
|
@@ -1255,7 +1255,7 @@ def _plain(he: str) -> str:
|
|
| 1255 |
# words rewritten for the voice wherever they appear: unpointed ืืื is read "David", ืืืจื is read
|
| 1256 |
# "chaverei" (my friends), ืฉืืืข is read "shvua" (oath), and ื' is said ืืืืืื
|
| 1257 |
MISREAD = {"ื'": "ืืืืืื", "ืืื": "ืึผืึนื", "ืืืื": "ืึทืึผืึนื", "ืืืื": "ืึผืึนืึดื", "ืืืืื": "ืึฐืืึนืึดื", "ืืืื ื": "ืึผืึนืึตื ืึผ",
|
| 1258 |
-
"ืืืจื": "ืึฒืึตืจึดื", "ืืืืจื": "ืึทืึฒืึตืจึดื", "ืฉืืืข": "ืฉึธืืืึผืขึท"}
|
| 1259 |
_MISREAD = re.compile(rf"(?<![\u05D0-\u05EA])({'|'.join(MISREAD)})(?![\u05D0-\u05EA])")
|
| 1260 |
|
| 1261 |
|
|
|
|
| 1255 |
# words rewritten for the voice wherever they appear: unpointed ืืื is read "David", ืืืจื is read
|
| 1256 |
# "chaverei" (my friends), ืฉืืืข is read "shvua" (oath), and ื' is said ืืืืืื
|
| 1257 |
MISREAD = {"ื'": "ืืืืืื", "ืืื": "ืึผืึนื", "ืืืื": "ืึทืึผืึนื", "ืืืื": "ืึผืึนืึดื", "ืืืืื": "ืึฐืืึนืึดื", "ืืืื ื": "ืึผืึนืึตื ืึผ",
|
| 1258 |
+
"ืืืจื": "ืึฒืึตืจึดื", "ืืืืจื": "ืึทืึฒืึตืจึดื", "ืฉืืืข": "ืฉึธืืืึผืขึท", "ืจืืืง": "ืจึทืึธึผืง"}
|
| 1259 |
_MISREAD = re.compile(rf"(?<![\u05D0-\u05EA])({'|'.join(MISREAD)})(?![\u05D0-\u05EA])")
|
| 1260 |
|
| 1261 |
|
openspec/changes/archive/.gitkeep
ADDED
|
File without changes
|
openspec/config.yaml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema: spec-driven
|
| 2 |
+
|
| 3 |
+
context: |
|
| 4 |
+
ihki is a mobile-first Hebrew/RTL learning application for spoken Palestinian
|
| 5 |
+
Arabic and 9th-grade mathematics. The production service is a FastAPI app
|
| 6 |
+
deployed as a Docker-based Hugging Face Space. Supabase authentication and
|
| 7 |
+
persistence are optional; when they are not configured, practice remains open.
|
| 8 |
+
Student-facing copy is primarily Hebrew, Arabic answers may use Arabic script
|
| 9 |
+
or Hebrew transliteration, and a practice day uses Asia/Jerusalem time.
|
| 10 |
+
Never expose Supabase secret keys, third-party API keys, private recordings, or
|
| 11 |
+
one student's identifiable data to another student.
|
| 12 |
+
|
| 13 |
+
rules:
|
| 14 |
+
proposal:
|
| 15 |
+
- State the learner or teacher outcome and what is explicitly out of scope
|
| 16 |
+
- Identify privacy, authorization, persistence, and paid-API impact
|
| 17 |
+
specs:
|
| 18 |
+
- Use observable behavior and concrete Given/When/Then scenarios
|
| 19 |
+
- Cover degraded behavior when optional Supabase, TTS, model, or browser capabilities are unavailable
|
| 20 |
+
design:
|
| 21 |
+
- Identify affected API endpoints, browser state, Supabase schema, and deployment configuration
|
| 22 |
+
- Preserve RTL, touch, keyboard, and no-mouse interaction where relevant
|
| 23 |
+
tasks:
|
| 24 |
+
- Include focused automated tests for server-side behavior
|
| 25 |
+
- Include a manual browser check for user-interface changes
|
| 26 |
+
|
| 27 |
+
operations:
|
| 28 |
+
apply:
|
| 29 |
+
guidance:
|
| 30 |
+
- Preserve unrelated working-tree changes
|
| 31 |
+
- Run focused tests before the full test suite
|
| 32 |
+
archive:
|
| 33 |
+
guidance:
|
| 34 |
+
- Confirm the implementation and migrations are reflected in the main specs
|
openspec/specs/.gitkeep
ADDED
|
File without changes
|
openspec/specs/access-and-privacy/spec.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Access and Privacy
|
| 2 |
+
|
| 3 |
+
## Purpose
|
| 4 |
+
|
| 5 |
+
Define sign-in, roles, feature entitlements, subject scope, and sensitive-data boundaries.
|
| 6 |
+
|
| 7 |
+
## Requirements
|
| 8 |
+
|
| 9 |
+
### Requirement: Optional authentication
|
| 10 |
+
The service SHALL require a valid Supabase session for practice when Supabase is configured and SHALL allow open practice when it is not configured.
|
| 11 |
+
|
| 12 |
+
#### Scenario: Protected request has no session
|
| 13 |
+
- **GIVEN** Supabase authentication is configured
|
| 14 |
+
- **WHEN** an unauthenticated client calls a protected practice endpoint
|
| 15 |
+
- **THEN** the service refuses the request
|
| 16 |
+
|
| 17 |
+
### Requirement: Role and entitlement authorization
|
| 18 |
+
The service SHALL authorize every protected server operation from the caller's roles, entitlements, class membership, and subject scope rather than trusting browser state.
|
| 19 |
+
|
| 20 |
+
#### Scenario: Student attempts a management operation
|
| 21 |
+
- **WHEN** a student without management permission calls a management endpoint
|
| 22 |
+
- **THEN** the service refuses the operation
|
| 23 |
+
|
| 24 |
+
#### Scenario: Tutor entitlement is absent
|
| 25 |
+
- **WHEN** a learner without the explicit tutor entitlement requests the paid tutor
|
| 26 |
+
- **THEN** the service refuses the request even if other student features are enabled
|
| 27 |
+
|
| 28 |
+
### Requirement: Administrative scope
|
| 29 |
+
Developers SHALL have full cross-subject access, subject admins SHALL manage only their assigned subject, and class teachers SHALL manage only their assigned classes.
|
| 30 |
+
|
| 31 |
+
#### Scenario: Subject admin targets another subject
|
| 32 |
+
- **WHEN** a subject admin attempts to change a class or user belonging to another subject
|
| 33 |
+
- **THEN** the service refuses the change
|
| 34 |
+
|
| 35 |
+
### Requirement: Secret isolation
|
| 36 |
+
The application SHALL keep service-role credentials and third-party API keys on the server and SHALL never return their plaintext values to the browser.
|
| 37 |
+
|
| 38 |
+
#### Scenario: Developer inspects configured keys
|
| 39 |
+
- **WHEN** an authorized developer opens key management
|
| 40 |
+
- **THEN** the browser receives presence and masked metadata only
|
| 41 |
+
|
| 42 |
+
### Requirement: Private recordings
|
| 43 |
+
The application SHALL store flagged and lab recordings in private storage and SHALL release them only through authorized server endpoints.
|
| 44 |
+
|
| 45 |
+
#### Scenario: Unauthorized user requests flag audio
|
| 46 |
+
- **WHEN** a caller without review permission requests a stored flag recording
|
| 47 |
+
- **THEN** the service refuses the request
|
openspec/specs/learning-activities/spec.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Learning Activities
|
| 2 |
+
|
| 3 |
+
## Purpose
|
| 4 |
+
|
| 5 |
+
Define conjugation games, stories, live lessons, the AI tutor, and the mathematics path.
|
| 6 |
+
|
| 7 |
+
## Requirements
|
| 8 |
+
|
| 9 |
+
### Requirement: Conjugation game integrity
|
| 10 |
+
The service SHALL generate conjugation questions from complete course tables, keep correct answers server-side, and allow each issued question to be graded at most once.
|
| 11 |
+
|
| 12 |
+
#### Scenario: Reusing a graded question
|
| 13 |
+
- **WHEN** a client submits another answer for an already graded question
|
| 14 |
+
- **THEN** the service refuses to grade it again
|
| 15 |
+
|
| 16 |
+
#### Scenario: Spoken answer is uncertain
|
| 17 |
+
- **WHEN** speech recognition is unrelated or below confidence
|
| 18 |
+
- **THEN** the outcome is uncertain
|
| 19 |
+
- **AND** it does not count as a grammatical attempt
|
| 20 |
+
|
| 21 |
+
### Requirement: Story quiz
|
| 22 |
+
The browser SHALL score each story line once, return skipped or unheard lines after the last line, and summarize the average and three most frequent mistakes.
|
| 23 |
+
|
| 24 |
+
#### Scenario: Learner ends early
|
| 25 |
+
- **WHEN** the learner ends a quiz before all lines are scored
|
| 26 |
+
- **THEN** the browser summarizes only the lines completed so far
|
| 27 |
+
|
| 28 |
+
### Requirement: Ephemeral live lesson
|
| 29 |
+
The service SHALL permit one active live session per class, give each learner one scored attempt per question, and keep session state only in application memory.
|
| 30 |
+
|
| 31 |
+
#### Scenario: Empty live answer
|
| 32 |
+
- **WHEN** a learner submits empty or undecodable audio
|
| 33 |
+
- **THEN** no scored attempt is consumed
|
| 34 |
+
- **AND** the learner may retry
|
| 35 |
+
|
| 36 |
+
#### Scenario: Session expires
|
| 37 |
+
- **WHEN** the teacher ends the session, the server restarts, or the teacher heartbeat is absent for two hours
|
| 38 |
+
- **THEN** attendance, answers, and live results are erased
|
| 39 |
+
|
| 40 |
+
### Requirement: Paid AI tutor limits
|
| 41 |
+
The service SHALL require the tutor entitlement, enforce configured daily and conversation limits, and never expose the Anthropic API key to the browser.
|
| 42 |
+
|
| 43 |
+
#### Scenario: Daily limit is reached
|
| 44 |
+
- **WHEN** a learner starts or continues beyond the daily allowance
|
| 45 |
+
- **THEN** the service refuses the paid model request with a limit result
|
| 46 |
+
|
| 47 |
+
### Requirement: Mathematics skill graph
|
| 48 |
+
The mathematics path SHALL unlock a skill only after all prerequisite skills are complete and SHALL reject invalid graphs with cycles, unknown or redundant dependencies, invalid answer counts, or remediation edges that point forward.
|
| 49 |
+
|
| 50 |
+
#### Scenario: Learner opens a locked skill
|
| 51 |
+
- **WHEN** the learner selects a skill with incomplete prerequisites
|
| 52 |
+
- **THEN** the browser identifies the prerequisite skills to complete first
|
| 53 |
+
|
| 54 |
+
### Requirement: Photographed mathematics problem privacy
|
| 55 |
+
The application SHALL send an authorized learner's photo to the configured model for structured solution help, SHALL not retain the photo, and SHALL disclose the external processing in the privacy page.
|
| 56 |
+
|
| 57 |
+
#### Scenario: Model cannot read a photo
|
| 58 |
+
- **WHEN** the model cannot extract a usable problem
|
| 59 |
+
- **THEN** the request does not consume the learner's daily photo allowance
|
openspec/specs/progress-and-practice/spec.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Progress and Practice
|
| 2 |
+
|
| 3 |
+
## Purpose
|
| 4 |
+
|
| 5 |
+
Define durable learner progress, daily practice, homework, and completion feedback.
|
| 6 |
+
|
| 7 |
+
## Requirements
|
| 8 |
+
|
| 9 |
+
### Requirement: Attempt persistence
|
| 10 |
+
When Supabase is configured, the service SHALL store attempt metadata under the authenticated learner and SHALL NOT store routine practice audio.
|
| 11 |
+
|
| 12 |
+
#### Scenario: Authenticated learner completes a score
|
| 13 |
+
- **WHEN** a learner receives a scored pronunciation result
|
| 14 |
+
- **THEN** the service stores the phrase, topic, score, diagnostic issues, model, and version for that learner
|
| 15 |
+
- **AND** does not store the recording bytes
|
| 16 |
+
|
| 17 |
+
#### Scenario: Supabase is not configured
|
| 18 |
+
- **WHEN** a visitor practices in open mode
|
| 19 |
+
- **THEN** scoring remains available
|
| 20 |
+
- **AND** durable cross-device progress is unavailable
|
| 21 |
+
|
| 22 |
+
### Requirement: Progress summary
|
| 23 |
+
The service SHALL summarize each learner's best score and attempts per phrase, practice days, weekly activity, and current and longest streaks.
|
| 24 |
+
|
| 25 |
+
#### Scenario: Learner returns on another device
|
| 26 |
+
- **GIVEN** the learner signs in to an account with stored attempts
|
| 27 |
+
- **WHEN** progress is requested
|
| 28 |
+
- **THEN** the learner's best scores and practice history are restored
|
| 29 |
+
|
| 30 |
+
### Requirement: Collection and completion
|
| 31 |
+
The browser SHALL represent practiced phrases as beads, make a bead gold at a best score of at least 75, and award a lesson masbaha only after every listed spoken phrase in that lesson is practiced.
|
| 32 |
+
|
| 33 |
+
#### Scenario: Story topic reaches gold
|
| 34 |
+
- **GIVEN** a story contains multiple lines
|
| 35 |
+
- **WHEN** every line has a best score of at least 75
|
| 36 |
+
- **THEN** the story is represented by one gold bead
|
| 37 |
+
|
| 38 |
+
### Requirement: Daily practice session
|
| 39 |
+
The browser SHALL build a ten-sentence daily session from weak practiced sentences and new course-ordered sentences, preferring homework and the first unfinished lesson.
|
| 40 |
+
|
| 41 |
+
#### Scenario: One pool has too few sentences
|
| 42 |
+
- **WHEN** either the weak or new sentence pool cannot supply its half
|
| 43 |
+
- **THEN** the other pool fills the remaining places
|
| 44 |
+
- **AND** story lines are excluded
|
| 45 |
+
|
| 46 |
+
### Requirement: Homework visibility and completion
|
| 47 |
+
The service SHALL support multiple unique homework topics per class, each with an optional due date, and SHALL consider a practice homework complete only after every sentence in its topic has been practiced.
|
| 48 |
+
|
| 49 |
+
#### Scenario: Homework due date passes
|
| 50 |
+
- **WHEN** the learner opens the path after the due date
|
| 51 |
+
- **THEN** the homework remains visible with overdue status
|
| 52 |
+
- **AND** it does not change the path's normal next-topic focus
|
openspec/specs/pronunciation-practice/spec.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Pronunciation Practice
|
| 2 |
+
|
| 3 |
+
## Purpose
|
| 4 |
+
|
| 5 |
+
Define how learners receive prompts, record spoken Arabic, and receive phoneme-level feedback.
|
| 6 |
+
|
| 7 |
+
## Requirements
|
| 8 |
+
|
| 9 |
+
### Requirement: Available phrase bank
|
| 10 |
+
The service SHALL return only the phrases and lesson content available to the current learner, including teacher-added texts in the learner's classes.
|
| 11 |
+
|
| 12 |
+
#### Scenario: Learner requests practice content
|
| 13 |
+
- **GIVEN** the learner is authorized for practice
|
| 14 |
+
- **WHEN** the learner requests the phrase bank
|
| 15 |
+
- **THEN** the response contains the built-in phrases and any eligible class text lines
|
| 16 |
+
- **AND** content outside the learner's lessons is excluded
|
| 17 |
+
|
| 18 |
+
### Requirement: Pronunciation scoring
|
| 19 |
+
The service SHALL compare a recording with every accepted pronunciation variant and return a 0โ100 result with word- and phoneme-level evidence.
|
| 20 |
+
|
| 21 |
+
#### Scenario: Recording matches an accepted variant
|
| 22 |
+
- **WHEN** a learner submits decodable audio for an available phrase
|
| 23 |
+
- **THEN** the service selects the best-fitting accepted variant
|
| 24 |
+
- **AND** returns sentence, word, and phoneme scores
|
| 25 |
+
- **AND** identifies substitutions and available Hebrew articulation tips
|
| 26 |
+
|
| 27 |
+
#### Scenario: Recording is unrelated
|
| 28 |
+
- **WHEN** the free phoneme decode is too far from every accepted variant
|
| 29 |
+
- **THEN** the result identifies the recording as an unrelated sentence
|
| 30 |
+
- **AND** does not present individual pronunciation tips as reliable findings
|
| 31 |
+
|
| 32 |
+
#### Scenario: Audio cannot be scored
|
| 33 |
+
- **WHEN** uploaded audio is empty, oversized, unsupported, or undecodable
|
| 34 |
+
- **THEN** the service rejects the attempt without recording a scored result
|
| 35 |
+
|
| 36 |
+
### Requirement: Native reference compensation
|
| 37 |
+
When a native TTS reference is available, the service SHALL compare learner sounds with the same model's scores for that reference so model errors in native speech do not unfairly reduce the learner score.
|
| 38 |
+
|
| 39 |
+
#### Scenario: Model also mishears the reference
|
| 40 |
+
- **GIVEN** the target sound is weak or misrecognized in the native reference
|
| 41 |
+
- **WHEN** the learner's result is assembled
|
| 42 |
+
- **THEN** the learner is not penalized solely for that model limitation
|
| 43 |
+
- **AND** no substitution tip is shown for it
|
| 44 |
+
|
| 45 |
+
### Requirement: Accessible feedback
|
| 46 |
+
The browser SHALL expose low-scoring letter feedback without requiring a mouse.
|
| 47 |
+
|
| 48 |
+
#### Scenario: Learner taps a marked letter
|
| 49 |
+
- **GIVEN** a letter has a score below 75 and a reason
|
| 50 |
+
- **WHEN** the learner taps the dotted-underlined letter
|
| 51 |
+
- **THEN** the browser shows the reason and tip near that letter
|
openspec/specs/quality-and-calibration/spec.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Quality and Calibration
|
| 2 |
+
|
| 3 |
+
## Purpose
|
| 4 |
+
|
| 5 |
+
Define how scoring errors are reported, reviewed, benchmarked, and calibrated safely.
|
| 6 |
+
|
| 7 |
+
## Requirements
|
| 8 |
+
|
| 9 |
+
### Requirement: Explicit scoring-error report
|
| 10 |
+
Only an authorized teacher or tutor SHALL be able to flag a scored attempt, and the report SHALL preserve the recording, score trace, model version, optional note, and private reporter identity for review.
|
| 11 |
+
|
| 12 |
+
#### Scenario: Authorized tutor flags an attempt
|
| 13 |
+
- **WHEN** the tutor states that a correctly spoken recording was scored incorrectly
|
| 14 |
+
- **THEN** the service stores the audio privately and creates a pending structured report
|
| 15 |
+
|
| 16 |
+
### Requirement: Human review before calibration
|
| 17 |
+
An authorized reviewer SHALL be able to confirm or reject a report, classify it, and identify false sound judgments; only confirmed evidence SHALL support calibration.
|
| 18 |
+
|
| 19 |
+
#### Scenario: Candidate is not yet approved
|
| 20 |
+
- **WHEN** repeated attempt data suggests a scoring issue
|
| 21 |
+
- **THEN** it remains an investigation candidate until a reviewer explicitly creates and applies a calibration
|
| 22 |
+
|
| 23 |
+
### Requirement: Diagnostic lab
|
| 24 |
+
The lab SHALL support labeled human and TTS samples, preserve benchmark recordings privately, and report false rejection and planted-error detection per sound.
|
| 25 |
+
|
| 26 |
+
#### Scenario: TTS benchmark runs
|
| 27 |
+
- **WHEN** an authorized user runs the automated TTS test
|
| 28 |
+
- **THEN** each item is scored without the native reference baseline
|
| 29 |
+
- **AND** the TTS speaker is reported separately from human speakers
|
| 30 |
+
|
| 31 |
+
### Requirement: Regression protection
|
| 32 |
+
Before a scoring model or rule change is shipped, its benchmark SHALL be compared with stored labeled samples so false rejection improves without silently reducing mistake detection.
|
| 33 |
+
|
| 34 |
+
#### Scenario: Current scorer is benchmarked
|
| 35 |
+
- **WHEN** stored samples are rescored with current model and rules
|
| 36 |
+
- **THEN** the output reports old and new per-sound results and aggregate detection metrics
|
openspec/specs/teacher-content/spec.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Teacher Content and Classes
|
| 2 |
+
|
| 3 |
+
## Purpose
|
| 4 |
+
|
| 5 |
+
Define class membership, course content, teacher-authored texts and videos, and monitoring.
|
| 6 |
+
|
| 7 |
+
## Requirements
|
| 8 |
+
|
| 9 |
+
### Requirement: Class configuration
|
| 10 |
+
Authorized staff SHALL be able to manage a class's students, nicknames, teachers, lessons, subject, homeworks, and scheduled daily videos.
|
| 11 |
+
|
| 12 |
+
#### Scenario: Class configuration changes
|
| 13 |
+
- **WHEN** an authorized staff member saves valid class settings
|
| 14 |
+
- **THEN** the settings are available to class members on their next page load
|
| 15 |
+
- **AND** duplicate homework topics and invalid subjects are rejected
|
| 16 |
+
|
| 17 |
+
### Requirement: Teacher-authored texts
|
| 18 |
+
Authorized staff SHALL be able to add a story or dialogue from paired Hebrew and Arabic-transliteration lines to an eligible lesson.
|
| 19 |
+
|
| 20 |
+
#### Scenario: Text line counts differ
|
| 21 |
+
- **WHEN** the Hebrew and Arabic-transliteration inputs contain different non-empty line counts
|
| 22 |
+
- **THEN** the service rejects the text and reports both counts
|
| 23 |
+
|
| 24 |
+
#### Scenario: Unknown transliterated word is accepted
|
| 25 |
+
- **WHEN** a word is not in the course lexicon but can be read by spelling rules
|
| 26 |
+
- **THEN** the text is created
|
| 27 |
+
- **AND** the response identifies the rule-read word for teacher review
|
| 28 |
+
|
| 29 |
+
### Requirement: Ordered lesson content
|
| 30 |
+
Authorized staff SHALL be able to place and reorder videos and teacher-authored texts among a lesson's built-in topics.
|
| 31 |
+
|
| 32 |
+
#### Scenario: Learner opens the path
|
| 33 |
+
- **WHEN** lesson content is requested
|
| 34 |
+
- **THEN** built-in topics, videos, and texts appear in the teacher-defined order
|
| 35 |
+
|
| 36 |
+
### Requirement: Privacy-preserving monitoring
|
| 37 |
+
Teacher activity views SHALL expose only learners and aggregate data within the caller's scope, and pronunciation-pattern reports SHALL not return learner identities.
|
| 38 |
+
|
| 39 |
+
#### Scenario: Repeated pronunciation issue becomes a candidate
|
| 40 |
+
- **GIVEN** the same judgment occurred in at least five attempts by at least three learners and at least 30 percent of learners who attempted the phrase
|
| 41 |
+
- **WHEN** a teacher opens pronunciation patterns
|
| 42 |
+
- **THEN** the pattern appears as an investigation candidate
|
| 43 |
+
- **AND** it is not automatically applied as a calibration
|
scripts/demo_video/README.md
CHANGED
|
@@ -24,11 +24,20 @@ D=scripts/demo_video; .venv/bin/python $D/record.py --takes $D/takes --out $D/ih
|
|
| 24 |
app says "ืืฆืืื" and shows no letters to tap; if a scoring change moves it, pick another take in make_takes.py.
|
| 25 |
- The app listens by itself after "next"; the recorder plays the take into the fake mic either way.
|
| 26 |
|
| 27 |
-
## The short promo (
|
| 28 |
|
| 29 |
-
The
|
| 30 |
-
|
| 31 |
-
the
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
```bash
|
| 34 |
D=scripts/demo_video; .venv/bin/python $D/promo.py --takes $D/takes --out $D/ihki-promo.mp4 --keep
|
|
|
|
| 24 |
app says "ืืฆืืื" and shows no letters to tap; if a scoring change moves it, pick another take in make_takes.py.
|
| 25 |
- The app listens by itself after "next"; the recorder plays the take into the fake mic either way.
|
| 26 |
|
| 27 |
+
## The short promo (66 s, a 3D iPhone)
|
| 28 |
|
| 29 |
+
The opening logo; "ืืืฉ! ืืืคืืืงืฆืื ืฉื ืืืื ืืกืืื"; the booklet (its cover face on, then lying open, pages flipping to
|
| 30 |
+
lesson 4's new verbs, the row "ืืืืจ ยท ืืื ยท ืืืื" circled); the app's core: that verb said with a Hebrew speaker's
|
| 31 |
+
mistake (ุญ said as a "dirty" ื', ุฎ), the red consonant and its tip, the retry at 100; collecting beads; driving mode
|
| 32 |
+
(the phone flies into a car's mount, the conversation in bubbles, a misbaha on the mirror whose next bead turns gold
|
| 33 |
+
on the verdict); a grid of the other ways to practice (lesson 4's new words, pairs, story, and "ืืคืืขื ืืืจืื"), each
|
| 34 |
+
coming forward for a short example; the summary beside "ืืขืจืืืช ืฉืืืจ ืฉืืื"; the animated logo. Silent.
|
| 35 |
+
|
| 36 |
+
The booklet's images are made once (cover from a photo, pages from the PDF), into `assets/`:
|
| 37 |
+
|
| 38 |
+
```bash
|
| 39 |
+
python scripts/demo_video/make_book.py <cover photo> "ืฉืื ื ืืืงืืืืจ 2026.pdf" scripts/demo_video/assets # needs Pillow, pdftoppm
|
| 40 |
+
```
|
| 41 |
|
| 42 |
```bash
|
| 43 |
D=scripts/demo_video; .venv/bin/python $D/promo.py --takes $D/takes --out $D/ihki-promo.mp4 --keep
|
scripts/demo_video/assets/cover.jpg
ADDED
|
Git LFS Details
|
scripts/demo_video/assets/p53.jpg
ADDED
|
Git LFS Details
|
scripts/demo_video/assets/p54.jpg
ADDED
|
Git LFS Details
|
scripts/demo_video/assets/p55.jpg
ADDED
|
Git LFS Details
|
scripts/demo_video/assets/p56.jpg
ADDED
|
Git LFS Details
|
scripts/demo_video/assets/p57.jpg
ADDED
|
Git LFS Details
|
scripts/demo_video/assets/p58.jpg
ADDED
|
Git LFS Details
|
scripts/demo_video/assets/p59.jpg
ADDED
|
Git LFS Details
|
scripts/demo_video/assets/p60.jpg
ADDED
|
Git LFS Details
|
scripts/demo_video/assets/p61.jpg
ADDED
|
Git LFS Details
|
scripts/demo_video/make_book.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""The booklet for the promo's opening: its cover, from a photo, and the pages that flip, from the booklet's PDF.
|
| 2 |
+
|
| 3 |
+
python scripts/demo_video/make_book.py <cover photo> <booklet pdf> <out dir>
|
| 4 |
+
|
| 5 |
+
The cover is straightened from the photo's four corners (COVER_CORNERS, set by hand for the photo of
|
| 6 |
+
"ืฉืื ื" on a wooden table), and its stage line is painted over with the cover's own white, so it stands for
|
| 7 |
+
either booklet. The pages are LEAVES' page numbers, then the spread the flip stops on (SPREAD: right, left):
|
| 8 |
+
lesson 4's new verbs, with "ืืืืจ ยท ืืื ยท ืืืื", the verb the app scene then practices.
|
| 9 |
+
Needs Pillow and pdftoppm (poppler-utils).
|
| 10 |
+
"""
|
| 11 |
+
import subprocess, sys
|
| 12 |
+
from pathlib import Path
|
| 13 |
+
import numpy as np
|
| 14 |
+
from PIL import Image
|
| 15 |
+
|
| 16 |
+
COVER_CORNERS = {"tl": (128, 346), "tr": (934, 350), "br": (980, 1544), "bl": (72, 1544)}
|
| 17 |
+
COVER_SIZE = (1000, 1377) # the booklet's proportions (654 x 901 pt)
|
| 18 |
+
STAGE_LINE = (330, 866, 620, 920) # where "ืฉืื ื" is on the straightened cover (x0, y0, x1, y1)
|
| 19 |
+
LEAVES = [(53, 54), (55, 56), (57, 58), (59, 60)] # (front: on the left before the flip, back: on the right after)
|
| 20 |
+
LEFT_BASE = 61 # the left page left when the flip is done
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def cover(photo: Path, out: Path):
|
| 24 |
+
im = Image.open(photo).convert("RGB")
|
| 25 |
+
c = COVER_CORNERS
|
| 26 |
+
cov = im.transform(COVER_SIZE, Image.QUAD, (*c["tl"], *c["bl"], *c["br"], *c["tr"]), Image.BICUBIC)
|
| 27 |
+
a = np.asarray(cov).copy()
|
| 28 |
+
x0, y0, x1, y1 = STAGE_LINE
|
| 29 |
+
above = a[y0 - 10:y0 - 3, x0:x1].mean(axis=0) # each column's white, from just above the line
|
| 30 |
+
a[y0:y1, x0:x1] = above[None, :, :].astype(np.uint8)
|
| 31 |
+
Image.fromarray(a).save(out / "cover.jpg", quality=90)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def pages(pdf: Path, out: Path):
|
| 35 |
+
for n in sorted({p for leaf in LEAVES for p in leaf} | {LEFT_BASE}):
|
| 36 |
+
stem = out / f"p{n}"
|
| 37 |
+
subprocess.run(["pdftoppm", "-r", "90", "-f", str(n), "-l", str(n), "-singlefile", "-jpeg",
|
| 38 |
+
"-jpegopt", "quality=85", str(pdf), str(stem)], check=True)
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
if __name__ == "__main__":
|
| 42 |
+
photo, pdf, out = Path(sys.argv[1]), Path(sys.argv[2]), Path(sys.argv[3])
|
| 43 |
+
out.mkdir(parents=True, exist_ok=True)
|
| 44 |
+
cover(photo, out)
|
| 45 |
+
pages(pdf, out)
|
| 46 |
+
print(sorted(p.name for p in out.iterdir()))
|
scripts/demo_video/promo.html
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<!doctype html>
|
| 2 |
-
<html lang="he" dir="
|
| 3 |
<head>
|
| 4 |
<meta charset="utf-8">
|
| 5 |
<title>ihki promo</title>
|
|
@@ -10,8 +10,11 @@
|
|
| 10 |
Nothing moves by itself: promo.py calls seek(t) for every frame, and everything is placed from t. */
|
| 11 |
:root{ --navy:#1F2156; --teal:#1E8C8C; --orange:#E8902E; --red:#C8344A; --cream:#FBF7EE; --ink:#1C241D; --muted:#5E685C; }
|
| 12 |
*{box-sizing:border-box}
|
| 13 |
-
html,body{margin:0;width:1080px;height:1920px;overflow:hidden;background:var(--cream)}
|
| 14 |
body{font-family:"Assistant",system-ui,sans-serif;color:var(--navy)}
|
|
|
|
|
|
|
|
|
|
| 15 |
#bg{position:absolute;inset:0;
|
| 16 |
background:
|
| 17 |
radial-gradient(900px 700px at 85% 8%, rgba(30,140,140,.16), transparent 70%),
|
|
@@ -43,6 +46,37 @@ body{font-family:"Assistant",system-ui,sans-serif;color:var(--navy)}
|
|
| 43 |
/* a ring around the red letter, drawn outside the phone's screen so it reads at a glance */
|
| 44 |
#ring{position:absolute;border:7px solid var(--red);border-radius:22px;box-shadow:0 0 0 10px rgba(200,52,74,.18);opacity:0}
|
| 45 |
/* the opening and closing */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
#logo{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:90px;opacity:0}
|
| 47 |
#logo svg{width:920px;height:auto}
|
| 48 |
#logo .cta{font:400 60px/1 "Secular One","Assistant",sans-serif;color:#fff;background:var(--navy);padding:28px 64px;border-radius:999px}
|
|
@@ -58,7 +92,7 @@ body{font-family:"Assistant",system-ui,sans-serif;color:var(--navy)}
|
|
| 58 |
#outro img{width:560px}
|
| 59 |
#outro .cta{font:400 54px/1 "Secular One","Assistant",sans-serif;color:#fff;background:var(--navy);padding:26px 56px;border-radius:999px}
|
| 60 |
/* driving mode: the phone in a car's mount, drawn flat in the logo's colors */
|
| 61 |
-
#car{position:absolute;inset:0;opacity:0}
|
| 62 |
#shield{position:absolute;left:-20px;right:-20px;top:330px;height:760px;border-radius:120px 120px 0 0;overflow:hidden;
|
| 63 |
box-shadow:inset 0 0 0 34px #1B1D2E}
|
| 64 |
#shield svg{display:block}
|
|
@@ -66,12 +100,12 @@ body{font-family:"Assistant",system-ui,sans-serif;color:var(--navy)}
|
|
| 66 |
background:linear-gradient(180deg,#2B2E4A 0%,#1F2138 30%,#171829 100%);box-shadow:0 -6px 0 #3A3E62 inset}
|
| 67 |
#dash .vent{position:absolute;top:120px;width:170px;height:46px;border-radius:23px;background:repeating-linear-gradient(90deg,#111222 0 14px,#25283F 14px 22px)}
|
| 68 |
#mount{position:absolute;left:676px;top:1170px;width:48px;height:240px;border-radius:24px;background:#3D405C;opacity:0}
|
| 69 |
-
#wheel{position:absolute;left:0;top:0;width:1080px;height:1920px;pointer-events:none;opacity:0}
|
| 70 |
.bub{position:absolute;padding:26px 40px;border-radius:44px;font:700 46px/1.25 "Assistant",sans-serif;opacity:0;
|
| 71 |
box-shadow:0 14px 34px rgba(0,0,0,.25);white-space:nowrap;direction:rtl}
|
| 72 |
.bub.app{background:#fff;color:var(--navy)} .bub.me{background:var(--teal);color:#fff}
|
| 73 |
.bub.ok{background:#2F7A4A;color:#fff}
|
| 74 |
-
.bub .
|
| 75 |
.bub::after{content:"";position:absolute;width:44px;height:44px;background:inherit;transform:rotate(45deg);border-radius:8px;z-index:-1}
|
| 76 |
.bub.app::after,.bub.ok::after{right:-14px;top:50%;margin-top:-22px}
|
| 77 |
.bub.me::after{left:60px;bottom:-14px}
|
|
@@ -81,6 +115,10 @@ body{font-family:"Assistant",system-ui,sans-serif;color:var(--navy)}
|
|
| 81 |
<body>
|
| 82 |
<div id="bg"></div>
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
<div id="car">
|
| 85 |
<div id="shield"><svg width="1120" height="760" viewBox="0 0 1120 760">
|
| 86 |
<defs><linearGradient id="sky" x1="0" x2="0" y1="0" y2="1"><stop offset="0" stop-color="#9FD6D2"/><stop offset=".55" stop-color="#F6E3C4"/><stop offset="1" stop-color="#F3C99A"/></linearGradient></defs>
|
|
@@ -92,17 +130,30 @@ body{font-family:"Assistant",system-ui,sans-serif;color:var(--navy)}
|
|
| 92 |
<path d="M520 400 L0 760 M600 400 L1120 760" stroke="#E8E2D0" stroke-width="8" fill="none"/>
|
| 93 |
<g id="dashes"></g>
|
| 94 |
</svg></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
<div id="dash"><div class="vent" style="right:120px"></div><div class="vent" style="right:330px"></div></div>
|
| 96 |
<div id="mount"></div>
|
| 97 |
</div>
|
| 98 |
<div id="band"></div>
|
|
|
|
|
|
|
|
|
|
| 99 |
<div class="cap" id="c1"><h1>ืืืืจืื ืืงืื</h1><p>ืจืืืื ืคืืขื ืืขืืจืืช,<br>ืืืืืจืื ืืืชื <b>ืืขืจืืืช ืืืืืจืช</b></p></div>
|
| 100 |
<div class="cap" id="c2"><h1>ืืืคืืืงืฆืื ืืงืฉืืื<br>ื<em>ืื ืขืืฆืืจ</em></h1><p>ืืืกืื ืช ืืืืื ืืช ืื<br>ืฉืื ื ืฉืืข ื ืืื</p></div>
|
| 101 |
<div class="cap" id="c3"><h1>ืืณ ืืืงืื <em>ื</em>?</h1><p>ืืืค ืฉื ืืชื <b>ืืืืืจื ืขืืจืืช</b>:<br>ืื ื ืฉืืข, ืืืื ืืชืงื ืื</p></div>
|
| 102 |
<div class="cap" id="c4"><h1>ืื ืกืื ืฉืื โ <em style="color:var(--teal)">100!</em></h1><p>ื ื ืงืืื, <b>ืืืืืง ืืื ืฉืฆืจืื</b></p></div>
|
| 103 |
<div class="cap" id="c5"><h1>ืื ืืฉืคื โ <em style="color:var(--orange)">ืืจืื</em> ๐ฟ</h1><p>ืึพ75 ืืืขืื ืืื ืืืืื โ
<br>ืืืืกืคืื ืืืชื ืืืืจื ืื ืืืจื</p></div>
|
| 104 |
<div class="cap" id="c7"><h1>ืืฆื ื ืกืืขื ๐</h1><p>ืืชืจืืืื <b>ืืื ืืืืื</b>: ืืืคืืืงืฆืื ืืงืจืืื,<br>ืืงืฉืืื ืืืืืจืช ืืช ืืฆืืื ืืงืื</p></div>
|
| 105 |
-
<div class="cap" id="
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
<div id="stage">
|
| 108 |
<div id="shadow"></div>
|
|
@@ -114,15 +165,21 @@ body{font-family:"Assistant",system-ui,sans-serif;color:var(--navy)}
|
|
| 114 |
</div>
|
| 115 |
</div>
|
| 116 |
<div id="ring"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
<svg id="wheel" viewBox="0 0 1080 1920"><g id="wheelG">
|
| 118 |
<circle cx="170" cy="1930" r="440" fill="none" stroke="#14151F" stroke-width="84"/>
|
| 119 |
<circle cx="170" cy="1930" r="440" fill="none" stroke="#2C2F45" stroke-width="10" stroke-dasharray="40 26" opacity=".7"/>
|
| 120 |
<path d="M170 1930 L560 1760" stroke="#14151F" stroke-width="70" stroke-linecap="round"/>
|
| 121 |
</g></svg>
|
| 122 |
<div class="bub app" id="b1">๐ ืืืืจ โ ืขืืจ ืืขืชืื</div>
|
| 123 |
-
<div class="bub me" id="b2">๐๏ธ <span class="
|
| 124 |
<div class="bub ok" id="b3">๐ ืืฆืืื! ยท 100 โ</div>
|
| 125 |
-
|
| 126 |
|
| 127 |
<div id="outro">
|
| 128 |
<h2>ืืขืจืืืช ืฉื ืืืืจื ืขืืจืืช<br>ื ืฉืืขืช ืืืจืช</h2>
|
|
@@ -136,7 +193,15 @@ body{font-family:"Assistant",system-ui,sans-serif;color:var(--navy)}
|
|
| 136 |
|
| 137 |
<script>
|
| 138 |
const $=id=>document.getElementById(id);
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
const SCREEN={w:609,h:1321,pad:16}, PHONE={w:641,h:1353,cx:220+641/2,cy:504+1353/2};
|
| 141 |
let F=[], M={}, END=0, KEYS=[], shown=null, LOGO_ANIMS=[];
|
| 142 |
|
|
@@ -161,15 +226,36 @@ const center=b=>[b[0]+b[2]/2,b[1]+b[3]/2];
|
|
| 161 |
async function setup(d){
|
| 162 |
F=d.frames; M=d.marks; END=M.end.t;
|
| 163 |
// the logo inline, so its own CSS animations can be stepped to each frame's time
|
| 164 |
-
|
|
|
|
| 165 |
LOGO_ANIMS=$("logoSvg").getAnimations({subtree:true}); LOGO_ANIMS.forEach(a=>a.pause());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
const S=t=>INTRO+t;
|
| 167 |
const rest={tx:0,ty:0,k:1,rx:4,ry:-16,rz:0}, away={tx:0,ty:1500,k:.9,rx:20,ry:-30,rz:-6};
|
|
|
|
| 168 |
const MOUNT={tx:700-PHONE.cx, ty:1290-PHONE.cy, k:.6, rx:0, ry:-6, rz:-3}; // in the car's mount, on the dashboard
|
| 169 |
const [lu,lv]=center(M.letter.box), [tu,tv]=M.tip&&M.tip.box&&M.tip.box[3]>0?center(M.tip.box):[.5,.85];
|
| 170 |
const [gu,gv]=center(M.great.box);
|
| 171 |
KEYS=[
|
| 172 |
-
[0,away],[INTRO+.4,rest],
|
| 173 |
[S(M.mic.t),{...rest,ry:-8}],
|
| 174 |
[S(M.score.t),{...rest,ry:-5,rx:2}],
|
| 175 |
[S(M.score.t)+.9,focus(lu,lv,1.5,540,1150,{ry:-4,rx:2})],
|
|
@@ -184,8 +270,10 @@ async function setup(d){
|
|
| 184 |
[S(M.drive.t)-.6,focus(.5,.3,1.18,540,1150,{ry:-4,rx:2})],
|
| 185 |
[S(M.drive.t)+.5,MOUNT],
|
| 186 |
[S(M.driveEnd.t)-.1,{...MOUNT,ry:-2}],
|
| 187 |
-
[S(M.
|
| 188 |
-
[S(
|
|
|
|
|
|
|
| 189 |
[S(END)+.7,away],
|
| 190 |
];
|
| 191 |
}
|
|
@@ -199,7 +287,29 @@ function stateAt(t){
|
|
| 199 |
function frameAt(s){ // the last screen frame at or before s
|
| 200 |
let lo=0, hi=F.length-1; while(lo<hi){ const m=(lo+hi+1)>>1; if(F[m].t<=s) lo=m; else hi=m-1; } return F[lo].file;
|
| 201 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
async function seek(t){
|
|
|
|
| 203 |
const s=Math.max(0,Math.min(END,t-INTRO)), file=frameAt(s);
|
| 204 |
if(file!==shown){ $("scr").src=file; await $("scr").decode().catch(()=>{}); shown=file; }
|
| 205 |
const p=stateAt(t);
|
|
@@ -209,10 +319,23 @@ async function seek(t){
|
|
| 209 |
$("gloss").style.backgroundPosition=`${p.ry*4}px 0`;
|
| 210 |
// the opening logo, then the headlines, each on its stretch
|
| 211 |
const S=x=>INTRO+x;
|
| 212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
["c4",S(M.retry.t)+.4,S(M.great.t)+1.5],["c5",S(M.great.t)+1.5,S(M.drive.t)-.2],
|
| 214 |
-
["c7",S(M.drive.t)-.2,S(M.driveEnd.t)+.2],
|
|
|
|
|
|
|
| 215 |
for(const [id,a,b] of caps){ const o=win(t,a,b); $(id).style.opacity=o; $(id).style.transform=`translateY(${(1-o)*30}px)`; }
|
|
|
|
|
|
|
| 216 |
// the car: in while the phone flies to the mount, out as it flies back
|
| 217 |
const car=win(t,S(M.drive.t)-.5,S(M.driveEnd.t)+.5,.7);
|
| 218 |
$("car").style.opacity=car; $("mount").style.opacity=ease((car-.6)/.4);
|
|
@@ -227,9 +350,37 @@ async function seek(t){
|
|
| 227 |
const bubs=[["b1",S(M.drive.t)+.5,S(M.turn.t)+.2,60,820],["b2",S(M.turn.t)+.3,S(M.verdict.t)+.1,80,1240],["b3",S(M.verdict.t)+.1,S(M.driveEnd.t)+.3,90,820]];
|
| 228 |
for(const [id,a,b,x,y] of bubs){ const o=win(t,a,b,.25);
|
| 229 |
Object.assign($(id).style,{left:x+"px",top:y+"px",opacity:o,transform:`scale(${lerp(.7,1,o)})`,transformOrigin:id==="b2"?"20% 100%":"100% 50%"}); }
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
// the ring on the red letter: after the camera has moved in, until the tip opens
|
| 234 |
const r=win(t,S(M.score.t)+.9,S(M.tap.t)+.25,.25);
|
| 235 |
if(r>0){ const b=M.letter.box, p0=onPhone(b[0],b[1]), w=b[2]*SCREEN.w*p.k, h=b[3]*SCREEN.h*p.k, pad=14;
|
|
@@ -238,14 +389,14 @@ async function seek(t){
|
|
| 238 |
transform:`scale(${1+.06*Math.sin((t-S(M.score.t))*7)})`}); }
|
| 239 |
else $("ring").style.opacity=0;
|
| 240 |
// the consonants, one by one; then the logo, its whole animation
|
| 241 |
-
|
|
|
|
| 242 |
const L=S(END)+CHIPS;
|
| 243 |
-
$("logo").style.opacity=ease((t-L+.2)/.4);
|
| 244 |
-
LOGO_ANIMS.forEach(a=>{ a.currentTime=Math.max(0,t-L)*1000; });
|
| 245 |
-
$("logo").querySelector(".cta").style.opacity=ease((t-L-
|
| 246 |
-
$("logo").querySelector(".cta").style.transform=`translateY(${(1-ease((t-L-
|
| 247 |
-
|
| 248 |
-
c.style.opacity=x; c.style.transform=`scale(${lerp(.6,1,x)})`; });
|
| 249 |
}
|
| 250 |
</script>
|
| 251 |
</body>
|
|
|
|
| 1 |
<!doctype html>
|
| 2 |
+
<html lang="he" dir="ltr">
|
| 3 |
<head>
|
| 4 |
<meta charset="utf-8">
|
| 5 |
<title>ihki promo</title>
|
|
|
|
| 10 |
Nothing moves by itself: promo.py calls seek(t) for every frame, and everything is placed from t. */
|
| 11 |
:root{ --navy:#1F2156; --teal:#1E8C8C; --orange:#E8902E; --red:#C8344A; --cream:#FBF7EE; --ink:#1C241D; --muted:#5E685C; }
|
| 12 |
*{box-sizing:border-box}
|
| 13 |
+
html,body{margin:0;width:1080px;height:1920px;overflow:hidden;background:var(--cream);overflow:clip}
|
| 14 |
body{font-family:"Assistant",system-ui,sans-serif;color:var(--navy)}
|
| 15 |
+
/* the page is laid out left to right (an RTL page scrolls sideways when something pokes past its left edge);
|
| 16 |
+
the Hebrew text is right to left */
|
| 17 |
+
.cap,#outro,#logo,.bub,#announce{direction:rtl}
|
| 18 |
#bg{position:absolute;inset:0;
|
| 19 |
background:
|
| 20 |
radial-gradient(900px 700px at 85% 8%, rgba(30,140,140,.16), transparent 70%),
|
|
|
|
| 46 |
/* a ring around the red letter, drawn outside the phone's screen so it reads at a glance */
|
| 47 |
#ring{position:absolute;border:7px solid var(--red);border-radius:22px;box-shadow:0 0 0 10px rgba(200,52,74,.18);opacity:0}
|
| 48 |
/* the opening and closing */
|
| 49 |
+
/* the announcement, and the booklet the app follows */
|
| 50 |
+
#announce{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:30px;padding-top:440px;
|
| 51 |
+
text-align:center;opacity:0;visibility:hidden}
|
| 52 |
+
#announce .new{font:800 40px/1 "Assistant",sans-serif;color:#fff;background:var(--red);padding:16px 34px;border-radius:999px}
|
| 53 |
+
#announce h1{margin:0;font:400 92px/1.1 "Secular One","Assistant",sans-serif;color:var(--navy)}
|
| 54 |
+
#announce p{margin:0;font:600 42px/1.4 "Assistant",sans-serif;color:var(--muted)}
|
| 55 |
+
#bookStage{position:absolute;inset:0;perspective:2400px;perspective-origin:50% 40%;visibility:hidden}
|
| 56 |
+
#book{position:absolute;left:0;top:0;width:0;height:0;transform-style:preserve-3d}
|
| 57 |
+
.leaf,.base{position:absolute;left:-520px;top:-358px;width:520px;height:716px;transform-style:preserve-3d;transform-origin:100% 50%}
|
| 58 |
+
.face{position:absolute;inset:0;background:#FBF9F4 center/100% 100% no-repeat;backface-visibility:hidden;border-radius:4px 0 0 4px;
|
| 59 |
+
box-shadow:inset -18px 0 24px -14px rgba(0,0,0,.25)}
|
| 60 |
+
.face.back{transform:rotateY(180deg);border-radius:0 4px 4px 0;box-shadow:inset 18px 0 24px -14px rgba(0,0,0,.25)}
|
| 61 |
+
.face .shade{position:absolute;inset:0;background:linear-gradient(90deg,rgba(0,0,0,.28),rgba(0,0,0,0));opacity:0}
|
| 62 |
+
#bookShadow{position:absolute;width:1150px;height:200px;border-radius:50%;background:radial-gradient(closest-side,rgba(31,33,86,.30),rgba(31,33,86,0));filter:blur(8px)}
|
| 63 |
+
#bookRing{position:absolute;border:7px solid var(--red);border-radius:18px;box-shadow:0 0 0 10px rgba(200,52,74,.18);opacity:0}
|
| 64 |
+
/* the summary: what the app is, beside its "ืืขืจืืืช ืฉืืืจ ืฉืืื" */
|
| 65 |
+
#pills{position:absolute;left:60px;right:60px;top:300px;display:grid;grid-template-columns:1fr 1fr;gap:20px;z-index:6;opacity:0;direction:rtl}
|
| 66 |
+
#pills div{background:#fff;border-radius:28px;padding:22px 20px;text-align:center;font:700 36px/1.2 "Assistant",sans-serif;color:var(--navy);
|
| 67 |
+
box-shadow:0 8px 24px rgba(31,33,86,.10),inset 0 0 0 3px rgba(31,33,86,.06)}
|
| 68 |
+
/* the grid of other ways to practice: four small phones, each zooming in for its example */
|
| 69 |
+
#grid{position:absolute;inset:0;perspective:2200px;visibility:hidden}
|
| 70 |
+
.tile{position:absolute;width:350px;height:740px;transform-style:preserve-3d;transform-origin:50% 50%}
|
| 71 |
+
.tile .ph{position:absolute;inset:0;border-radius:46px;background:#0D0D10;padding:10px;
|
| 72 |
+
box-shadow:inset 0 0 0 2px #A9AEB6,inset 0 0 0 4px #4B4E55, 18px 30px 50px rgba(31,33,86,.22)}
|
| 73 |
+
.tile .scr{width:330px;height:714px;border-radius:38px;overflow:hidden;position:relative;background:#EEF0E8}
|
| 74 |
+
.tile .scr img{width:100%;height:100%;display:block}
|
| 75 |
+
.tile .isl{position:absolute;top:12px;left:50%;width:100px;height:30px;margin-left:-50px;border-radius:16px;background:#000}
|
| 76 |
+
.tile .lab{position:absolute;left:50%;bottom:-34px;transform:translateX(-50%) translateZ(30px);white-space:nowrap;direction:rtl;
|
| 77 |
+
font:800 36px/1 "Assistant",sans-serif;color:#fff;background:var(--navy);padding:18px 30px;border-radius:999px;box-shadow:0 10px 24px rgba(31,33,86,.25)}
|
| 78 |
+
#open{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;opacity:0;direction:rtl}
|
| 79 |
+
#open svg{width:900px;height:auto}
|
| 80 |
#logo{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:90px;opacity:0}
|
| 81 |
#logo svg{width:920px;height:auto}
|
| 82 |
#logo .cta{font:400 60px/1 "Secular One","Assistant",sans-serif;color:#fff;background:var(--navy);padding:28px 64px;border-radius:999px}
|
|
|
|
| 92 |
#outro img{width:560px}
|
| 93 |
#outro .cta{font:400 54px/1 "Secular One","Assistant",sans-serif;color:#fff;background:var(--navy);padding:26px 56px;border-radius:999px}
|
| 94 |
/* driving mode: the phone in a car's mount, drawn flat in the logo's colors */
|
| 95 |
+
#car{position:absolute;inset:0;opacity:0;overflow:hidden} /* clipped: past the left edge, an RTL page would shift */
|
| 96 |
#shield{position:absolute;left:-20px;right:-20px;top:330px;height:760px;border-radius:120px 120px 0 0;overflow:hidden;
|
| 97 |
box-shadow:inset 0 0 0 34px #1B1D2E}
|
| 98 |
#shield svg{display:block}
|
|
|
|
| 100 |
background:linear-gradient(180deg,#2B2E4A 0%,#1F2138 30%,#171829 100%);box-shadow:0 -6px 0 #3A3E62 inset}
|
| 101 |
#dash .vent{position:absolute;top:120px;width:170px;height:46px;border-radius:23px;background:repeating-linear-gradient(90deg,#111222 0 14px,#25283F 14px 22px)}
|
| 102 |
#mount{position:absolute;left:676px;top:1170px;width:48px;height:240px;border-radius:24px;background:#3D405C;opacity:0}
|
| 103 |
+
#wheel{position:absolute;left:0;top:0;width:1080px;height:1920px;pointer-events:none;opacity:0;overflow:hidden}
|
| 104 |
.bub{position:absolute;padding:26px 40px;border-radius:44px;font:700 46px/1.25 "Assistant",sans-serif;opacity:0;
|
| 105 |
box-shadow:0 14px 34px rgba(0,0,0,.25);white-space:nowrap;direction:rtl}
|
| 106 |
.bub.app{background:#fff;color:var(--navy)} .bub.me{background:var(--teal);color:#fff}
|
| 107 |
.bub.ok{background:#2F7A4A;color:#fff}
|
| 108 |
+
.bub .tr{font:800 56px/1.2 "Assistant",sans-serif}
|
| 109 |
.bub::after{content:"";position:absolute;width:44px;height:44px;background:inherit;transform:rotate(45deg);border-radius:8px;z-index:-1}
|
| 110 |
.bub.app::after,.bub.ok::after{right:-14px;top:50%;margin-top:-22px}
|
| 111 |
.bub.me::after{left:60px;bottom:-14px}
|
|
|
|
| 115 |
<body>
|
| 116 |
<div id="bg"></div>
|
| 117 |
|
| 118 |
+
<div id="open"><div id="openSvg"></div></div>
|
| 119 |
+
<div id="announce"><div class="new">ืืืฉ!</div><h1>ืืืคืืืงืฆืื ืฉื<br>ืืืื ืืกืืื</h1><p>ืืชืจืืืื ืขืจืืืช ืืืืืจืช,<br>ืืื ืืงืื ืืืื ืืื</p></div>
|
| 120 |
+
<div id="bookStage"><div id="bookShadow"></div><div id="book"></div></div>
|
| 121 |
+
<div id="bookRing"></div>
|
| 122 |
<div id="car">
|
| 123 |
<div id="shield"><svg width="1120" height="760" viewBox="0 0 1120 760">
|
| 124 |
<defs><linearGradient id="sky" x1="0" x2="0" y1="0" y2="1"><stop offset="0" stop-color="#9FD6D2"/><stop offset=".55" stop-color="#F6E3C4"/><stop offset="1" stop-color="#F3C99A"/></linearGradient></defs>
|
|
|
|
| 130 |
<path d="M520 400 L0 760 M600 400 L1120 760" stroke="#E8E2D0" stroke-width="8" fill="none"/>
|
| 131 |
<g id="dashes"></g>
|
| 132 |
</svg></div>
|
| 133 |
+
<svg id="mirror" width="1080" height="1920" viewBox="0 0 1080 1920" style="position:absolute;left:0;top:0">
|
| 134 |
+
<rect x="532" y="362" width="16" height="62" rx="6" fill="#1B1D2E"/>
|
| 135 |
+
<rect x="400" y="418" width="280" height="80" rx="38" fill="#1B1D2E"/>
|
| 136 |
+
<rect x="414" y="430" width="252" height="56" rx="28" fill="#9CC4CB" opacity=".55"/>
|
| 137 |
+
<g id="mis"></g>
|
| 138 |
+
</svg>
|
| 139 |
<div id="dash"><div class="vent" style="right:120px"></div><div class="vent" style="right:330px"></div></div>
|
| 140 |
<div id="mount"></div>
|
| 141 |
</div>
|
| 142 |
<div id="band"></div>
|
| 143 |
+
<div class="cap" id="cb"><h1>ืื ืืื ืืืืืง <em style="color:var(--teal)">ืืคื ืืืืืจืช</em> ๐</h1><p>ืื ืฉืืขืืจ ืืืืืจืช ืืื ื ืืฉื ืืืคืืืงืฆืื,<br>ืขื ืืืชื ืคืขืืื ืืืืชื ืืฉืคืืื</p></div>
|
| 144 |
+
<div class="cap" id="c8"><h1>ืื ืืขืจืืืช ืฉืืื, <em style="color:var(--teal)">ืืืงืื ืืื</em></h1></div>
|
| 145 |
+
<div id="pills"><div>๐๏ธ ืฉืืืขืช ืื ืขืืฆืืจ</div><div>๐ ืืคื ืืืืืจืช</div><div>๐ ืืฆื ื ืกืืขื</div><div>๐ฟ ืืจืืืื ืืืฉืืงืื</div></div>
|
| 146 |
<div class="cap" id="c1"><h1>ืืืืจืื ืืงืื</h1><p>ืจืืืื ืคืืขื ืืขืืจืืช,<br>ืืืืืจืื ืืืชื <b>ืืขืจืืืช ืืืืืจืช</b></p></div>
|
| 147 |
<div class="cap" id="c2"><h1>ืืืคืืืงืฆืื ืืงืฉืืื<br>ื<em>ืื ืขืืฆืืจ</em></h1><p>ืืืกืื ืช ืืืืื ืืช ืื<br>ืฉืื ื ืฉืืข ื ืืื</p></div>
|
| 148 |
<div class="cap" id="c3"><h1>ืืณ ืืืงืื <em>ื</em>?</h1><p>ืืืค ืฉื ืืชื <b>ืืืืืจื ืขืืจืืช</b>:<br>ืื ื ืฉืืข, ืืืื ืืชืงื ืื</p></div>
|
| 149 |
<div class="cap" id="c4"><h1>ืื ืกืื ืฉืื โ <em style="color:var(--teal)">100!</em></h1><p>ื ื ืงืืื, <b>ืืืืืง ืืื ืฉืฆืจืื</b></p></div>
|
| 150 |
<div class="cap" id="c5"><h1>ืื ืืฉืคื โ <em style="color:var(--orange)">ืืจืื</em> ๐ฟ</h1><p>ืึพ75 ืืืขืื ืืื ืืืืื โ
<br>ืืืืกืคืื ืืืชื ืืืืจื ืื ืืืจื</p></div>
|
| 151 |
<div class="cap" id="c7"><h1>ืืฆื ื ืกืืขื ๐</h1><p>ืืชืจืืืื <b>ืืื ืืืืื</b>: ืืืคืืืงืฆืื ืืงืจืืื,<br>ืืงืฉืืื ืืืืืจืช ืืช ืืฆืืื ืืงืื</p></div>
|
| 152 |
+
<div class="cap" id="cg"><h1>ืืขืื ืืจืืื ืืชืจืื</h1></div>
|
| 153 |
+
<div class="cap" id="cw"><h1>๐ ืืืืื ืืืฉืืช</h1><p>ื ืืืจืื, ืืื ืืืฉืคืื ืืช ืืืืื</p></div>
|
| 154 |
+
<div class="cap" id="cp"><h1>๐งฉ ืืืืืช ืืืืื</h1><p>ืืืืจืื ืื ืืืื ืืชืขืชืืง ืฉืื</p></div>
|
| 155 |
+
<div class="cap" id="cs"><h1>๐ฌ ืกืืคืืจ</h1><p>ืฉืืืขืื ืืช ืื ืืกืืคืืจ,<br>ืืืืืจืื ืฉืืจื ืืืจื ืฉืืจื</p></div>
|
| 156 |
+
<div class="cap" id="cm"><h1>๐ฟ ืืคืืขื ืืืจืื</h1><p>ืืืคืืื ืืจืืืื ืืืืฆืืื ืืืืืช<br>ืฉื ืคืขืืื ืืขืืจืืช ืืืขืจืืืช</p></div>
|
| 157 |
|
| 158 |
<div id="stage">
|
| 159 |
<div id="shadow"></div>
|
|
|
|
| 165 |
</div>
|
| 166 |
</div>
|
| 167 |
<div id="ring"></div>
|
| 168 |
+
<div id="grid">
|
| 169 |
+
<div class="tile" id="tw"><div class="ph"><div class="scr"><img alt=""><div class="isl"></div></div></div><div class="lab">๐ ืืืืื ืืืฉืืช</div></div>
|
| 170 |
+
<div class="tile" id="tp"><div class="ph"><div class="scr"><img alt=""><div class="isl"></div></div></div><div class="lab">๐งฉ ืืืืืช ืืืืื</div></div>
|
| 171 |
+
<div class="tile" id="ts"><div class="ph"><div class="scr"><img alt=""><div class="isl"></div></div></div><div class="lab">๐ฌ ืกืืคืืจ</div></div>
|
| 172 |
+
<div class="tile" id="tm"><div class="ph"><div class="scr"><img alt=""><div class="isl"></div></div></div><div class="lab">๐ฟ ืืคืืขื ืืืจืื</div></div>
|
| 173 |
+
</div>
|
| 174 |
<svg id="wheel" viewBox="0 0 1080 1920"><g id="wheelG">
|
| 175 |
<circle cx="170" cy="1930" r="440" fill="none" stroke="#14151F" stroke-width="84"/>
|
| 176 |
<circle cx="170" cy="1930" r="440" fill="none" stroke="#2C2F45" stroke-width="10" stroke-dasharray="40 26" opacity=".7"/>
|
| 177 |
<path d="M170 1930 L560 1760" stroke="#14151F" stroke-width="70" stroke-linecap="round"/>
|
| 178 |
</g></svg>
|
| 179 |
<div class="bub app" id="b1">๐ ืืืืจ โ ืขืืจ ืืขืชืื</div>
|
| 180 |
+
<div class="bub me" id="b2">๐๏ธ <span class="tr">ืึทืึทื, ืึดืึฐืึดึผื</span></div>
|
| 181 |
<div class="bub ok" id="b3">๐ ืืฆืืื! ยท 100 โ</div>
|
| 182 |
+
|
| 183 |
|
| 184 |
<div id="outro">
|
| 185 |
<h2>ืืขืจืืืช ืฉื ืืืืจื ืขืืจืืช<br>ื ืฉืืขืช ืืืจืช</h2>
|
|
|
|
| 193 |
|
| 194 |
<script>
|
| 195 |
const $=id=>document.getElementById(id);
|
| 196 |
+
// the opening logo, the announcement and the booklet come before the screen; the animated logo closes
|
| 197 |
+
// the logo stays up while the description rises under it
|
| 198 |
+
const OPEN_END=4.2, ANN=[1.0,4.2], BOOK0=4.0, BOOK_LEN=7.0, INTRO=BOOK0+BOOK_LEN, CHIPS=0.5, LOGO=6.8, LOGO_SPEED=1.2;
|
| 199 |
+
const PW=520, PH=716; // a booklet page on the frame
|
| 200 |
+
const LEAVES=[["cover.jpg",null],["p53.jpg","p54.jpg"],["p55.jpg","p56.jpg"],["p57.jpg","p58.jpg"],["p59.jpg","p60.jpg"]];
|
| 201 |
+
const ROW={u:.13,v:.293,w:.67,h:.034}; // "ืืืืจ ยท ืืื ยท ืืืื" on page 60 (the last leaf's back), as page fractions
|
| 202 |
+
// the grid: each tile's place, and the example it plays (its marks)
|
| 203 |
+
const TILES=[["tw","w",600,250,-9],["tp","p",130,250,9],["ts","s",600,1060,-9],["tm","m",130,1060,9]]; // id, mark, left, top, rotateY
|
| 204 |
+
const MIS={n:13, gold:4}; // the misbaha's beads, and how many are gold before the verdict
|
| 205 |
const SCREEN={w:609,h:1321,pad:16}, PHONE={w:641,h:1353,cx:220+641/2,cy:504+1353/2};
|
| 206 |
let F=[], M={}, END=0, KEYS=[], shown=null, LOGO_ANIMS=[];
|
| 207 |
|
|
|
|
| 226 |
async function setup(d){
|
| 227 |
F=d.frames; M=d.marks; END=M.end.t;
|
| 228 |
// the logo inline, so its own CSS animations can be stepped to each frame's time
|
| 229 |
+
const svg=await (await fetch("logo-intro.svg")).text();
|
| 230 |
+
$("logoSvg").innerHTML=svg;
|
| 231 |
LOGO_ANIMS=$("logoSvg").getAnimations({subtree:true}); LOGO_ANIMS.forEach(a=>a.pause());
|
| 232 |
+
// the opening: a second copy (its ids renamed, so the two don't share them), at the animation's end
|
| 233 |
+
$("openSvg").innerHTML=svg.replace(/id="([\w-]+)"/g,'id="o_$1"').replace(/href="#([\w-]+)"/g,'href="#o_$1"').replace(/url\(#([\w-]+)\)/g,"url(#o_$1)");
|
| 234 |
+
$("openSvg").getAnimations({subtree:true}).forEach(a=>{ a.pause(); a.currentTime=60000; });
|
| 235 |
+
const base=document.createElement("div"); base.className="base"; // the left page under every leaf
|
| 236 |
+
base.innerHTML=`<div class="face" style="background-image:url(assets/p61.jpg)"></div>`; $("book").append(base);
|
| 237 |
+
LEAVES.forEach(([front,back],i)=>{ const l=document.createElement("div"); l.className="leaf"; l.dataset.z=LEAVES.length-i;
|
| 238 |
+
l.innerHTML=`<div class="face" style="background-image:url(assets/${front})"><div class="shade"></div></div>`+
|
| 239 |
+
`<div class="face back" style="${back?`background-image:url(assets/${back})`:"background:#F4F1EA"}"><div class="shade"></div></div>`;
|
| 240 |
+
$("book").append(l); });
|
| 241 |
+
await Promise.all([...document.querySelectorAll("#book .face")].map(f=>{ const m=/url\("?([^")]+)/.exec(f.style.backgroundImage);
|
| 242 |
+
if(!m) return null; const im=new Image(); im.src=m[1]; return im.decode().catch(()=>{}); }));
|
| 243 |
+
let mis=`<path id="misCord" fill="none" stroke="#B88A3A" stroke-width="4"/>`;
|
| 244 |
+
for(let i=0;i<MIS.n;i++){ const a=(-70+320*i/(MIS.n-1))*Math.PI/180, x=540+62*Math.cos(a), y=600+95*Math.sin(a);
|
| 245 |
+
mis+=`<circle class="bead" cx="${x}" cy="${y}" r="14" fill="${i<MIS.gold?"#E2A93B":"#2E9C9C"}" stroke="rgba(0,0,0,.25)" stroke-width="2"/>`+
|
| 246 |
+
`<circle cx="${x-4}" cy="${y-5}" r="4" fill="#fff" opacity=".6"/>`; }
|
| 247 |
+
mis+=`<circle id="sparkle" cx="0" cy="0" r="14" fill="none" stroke="#FFD86B" stroke-width="5" opacity="0"/>`+
|
| 248 |
+
`<circle cx="540" cy="716" r="18" fill="#2E9C9C" stroke="rgba(0,0,0,.25)" stroke-width="2"/>`+
|
| 249 |
+
`<path d="M540 732 L522 790 M540 732 L534 794 M540 732 L546 794 M540 732 L558 790" stroke="#B88A3A" stroke-width="5" stroke-linecap="round"/>`;
|
| 250 |
+
$("mis").innerHTML=mis;
|
| 251 |
const S=t=>INTRO+t;
|
| 252 |
const rest={tx:0,ty:0,k:1,rx:4,ry:-16,rz:0}, away={tx:0,ty:1500,k:.9,rx:20,ry:-30,rz:-6};
|
| 253 |
+
const SUM={tx:0, ty:150, k:.88, rx:3, ry:-9, rz:0}; // beside the summary's pills
|
| 254 |
const MOUNT={tx:700-PHONE.cx, ty:1290-PHONE.cy, k:.6, rx:0, ry:-6, rz:-3}; // in the car's mount, on the dashboard
|
| 255 |
const [lu,lv]=center(M.letter.box), [tu,tv]=M.tip&&M.tip.box&&M.tip.box[3]>0?center(M.tip.box):[.5,.85];
|
| 256 |
const [gu,gv]=center(M.great.box);
|
| 257 |
KEYS=[
|
| 258 |
+
[0,away],[INTRO-.9,away],[INTRO+.4,rest],
|
| 259 |
[S(M.mic.t),{...rest,ry:-8}],
|
| 260 |
[S(M.score.t),{...rest,ry:-5,rx:2}],
|
| 261 |
[S(M.score.t)+.9,focus(lu,lv,1.5,540,1150,{ry:-4,rx:2})],
|
|
|
|
| 270 |
[S(M.drive.t)-.6,focus(.5,.3,1.18,540,1150,{ry:-4,rx:2})],
|
| 271 |
[S(M.drive.t)+.5,MOUNT],
|
| 272 |
[S(M.driveEnd.t)-.1,{...MOUNT,ry:-2}],
|
| 273 |
+
[S(M.w0.t)+.5,{tx:600+175-PHONE.cx, ty:250+370-PHONE.cy, k:350/641, rx:3, ry:-9, rz:0}], // shrinks into the grid's first tile
|
| 274 |
+
[S(M.shelf.t)-.3,{...rest,ry:6,rx:3}],
|
| 275 |
+
[S(M.shelf.t)+.6,SUM],
|
| 276 |
+
[S(END),{...SUM,ry:-4}],
|
| 277 |
[S(END)+.7,away],
|
| 278 |
];
|
| 279 |
}
|
|
|
|
| 287 |
function frameAt(s){ // the last screen frame at or before s
|
| 288 |
let lo=0, hi=F.length-1; while(lo<hi){ const m=(lo+hi+1)>>1; if(F[m].t<=s) lo=m; else hi=m-1; } return F[lo].file;
|
| 289 |
}
|
| 290 |
+
function drawBook(t){
|
| 291 |
+
const b=t-BOOK0, on=t>BOOK0-.1&&t<INTRO+.3;
|
| 292 |
+
$("bookStage").style.visibility=on?"visible":"hidden"; $("bookRing").style.opacity=0; if(!on) return;
|
| 293 |
+
// the booklet: face on and closed (its spine on the right), then lying down, open, flat for a close look at the verb
|
| 294 |
+
const lay=ease((b-.9)/1.0), flat=ease((b-4.3)/.9), k0=lerp(lerp(1.16,1.22,ease(b/.9)),.92,lay);
|
| 295 |
+
const k=lerp(k0,1.55,flat), rx=lerp(lerp(0,54,lay),4,flat), rz=lerp(lerp(0,-7,lay),0,flat);
|
| 296 |
+
const fu=ROW.u+ROW.w/2, fv=ROW.v+ROW.h/2; // the row comes to the frame's middle
|
| 297 |
+
const sx=lerp(lerp(540+PW*k0/2,540,lay),540-k*fu*PW,flat), sy=lerp(lerp(1040,1110,lay),1060-k*(fv-.5)*PH,flat);
|
| 298 |
+
$("book").style.transform=`translate(${sx}px,${sy}px) rotateX(${rx}deg) rotateZ(${rz}deg) scale(${k})`;
|
| 299 |
+
Object.assign($("bookShadow").style,{left:sx-575+"px",top:sy+PH*k*.32+"px",opacity:lay*(1-flat)});
|
| 300 |
+
const out=1-ease((t-(INTRO-.45))/.4); $("bookStage").style.opacity=Math.min(ease(b/.4),out);
|
| 301 |
+
const flips=[[1.7,.8],[2.5,.55],[2.92,.55],[3.34,.55],[3.76,.55]]; // the cover, then the four leaves: start, length
|
| 302 |
+
[...document.querySelectorAll("#book .leaf")].forEach((l,i)=>{ const [a,d]=flips[i], x=ease((b-a)/d), ang=180*x;
|
| 303 |
+
l.style.transform=`rotateY(${ang}deg) translateZ(${l.dataset.z*1.2}px)`;
|
| 304 |
+
l.querySelectorAll(".shade").forEach(s=>s.style.opacity=Math.sin(Math.PI*x)*.9); });
|
| 305 |
+
// the ring on the row, once the booklet lies flat
|
| 306 |
+
const r=win(b,5.1,BOOK_LEN-.1,.25);
|
| 307 |
+
if(r>0){ const x=sx+k*ROW.u*PW, y=sy+k*(ROW.v-.5)*PH, pad=12;
|
| 308 |
+
Object.assign($("bookRing").style,{left:x-pad+"px",top:y-pad+"px",width:k*ROW.w*PW+2*pad+"px",height:k*ROW.h*PH+2*pad+"px",
|
| 309 |
+
opacity:Math.min(r,out),transform:`scale(${1+.05*Math.sin(b*7)})`}); }
|
| 310 |
+
}
|
| 311 |
async function seek(t){
|
| 312 |
+
if(scrollX||scrollY) scrollTo(0,0);
|
| 313 |
const s=Math.max(0,Math.min(END,t-INTRO)), file=frameAt(s);
|
| 314 |
if(file!==shown){ $("scr").src=file; await $("scr").decode().catch(()=>{}); shown=file; }
|
| 315 |
const p=stateAt(t);
|
|
|
|
| 319 |
$("gloss").style.backgroundPosition=`${p.ry*4}px 0`;
|
| 320 |
// the opening logo, then the headlines, each on its stretch
|
| 321 |
const S=x=>INTRO+x;
|
| 322 |
+
// the opening logo: in, a slow push, out for the announcement
|
| 323 |
+
const op=Math.min(ease(t/.5),1-ease((t-(OPEN_END-.4))/.5)), up=ease((t-1.0)/.8); // up: the logo's way to the top
|
| 324 |
+
$("open").style.opacity=op; $("open").style.visibility=op>0?"visible":"hidden"; // drawn only while shown: the logo is heavy (visibility keeps its animations, display would drop them)
|
| 325 |
+
$("open").style.transform=`translateY(${-420*up}px) scale(${lerp(.94,1,ease(t/1.0))*lerp(1,.82,up)})`;
|
| 326 |
+
// the description rises from the bottom to the middle, under the logo, and leaves with it
|
| 327 |
+
const rise=ease((t-ANN[0]-.2)/.8), an=Math.min(ease((t-ANN[0]-.2)/.4),1-ease((t-(ANN[1]-.4))/.5));
|
| 328 |
+
$("announce").style.opacity=an; $("announce").style.visibility=an>0?"visible":"hidden";
|
| 329 |
+
$("announce").style.transform=`translateY(${(1-rise)*820}px)`;
|
| 330 |
+
drawBook(t);
|
| 331 |
+
const caps=[["cb",BOOK0+.9,INTRO-.5],["c1",INTRO-.5,S(M.score.t)+.2],["c8",S(M.shelf.t)-.1,S(END)+.4],["c2",S(M.score.t)+.2,S(M.tap.t)+.6],["c3",S(M.tap.t)+.6,S(M.retry.t)+.4],
|
| 332 |
["c4",S(M.retry.t)+.4,S(M.great.t)+1.5],["c5",S(M.great.t)+1.5,S(M.drive.t)-.2],
|
| 333 |
+
["c7",S(M.drive.t)-.2,S(M.driveEnd.t)+.2],
|
| 334 |
+
["cg",S(M.w0.t)-.1,S(M.w0.t)+1.6],["cw",S(M.w0.t)+1.6,S(M.w1.t)-.2],["cp",S(M.p0.t)+.1,S(M.p1.t)-.2],
|
| 335 |
+
["cs",S(M.s0.t)+.1,S(M.s1.t)-.2],["cm",S(M.m0.t)+.1,S(M.m1.t)-.3]];
|
| 336 |
for(const [id,a,b] of caps){ const o=win(t,a,b); $(id).style.opacity=o; $(id).style.transform=`translateY(${(1-o)*30}px)`; }
|
| 337 |
+
const pl=win(t,S(M.shelf.t)+.2,S(END)+.4,.4); $("pills").style.opacity=pl;
|
| 338 |
+
[...$("pills").children].forEach((d,i)=>{ const x=ease((t-S(M.shelf.t)-.3-i*.15)/.35); d.style.opacity=x; d.style.transform=`scale(${lerp(.7,1,x)})`; });
|
| 339 |
// the car: in while the phone flies to the mount, out as it flies back
|
| 340 |
const car=win(t,S(M.drive.t)-.5,S(M.driveEnd.t)+.5,.7);
|
| 341 |
$("car").style.opacity=car; $("mount").style.opacity=ease((car-.6)/.4);
|
|
|
|
| 350 |
const bubs=[["b1",S(M.drive.t)+.5,S(M.turn.t)+.2,60,820],["b2",S(M.turn.t)+.3,S(M.verdict.t)+.1,80,1240],["b3",S(M.verdict.t)+.1,S(M.driveEnd.t)+.3,90,820]];
|
| 351 |
for(const [id,a,b,x,y] of bubs){ const o=win(t,a,b,.25);
|
| 352 |
Object.assign($(id).style,{left:x+"px",top:y+"px",opacity:o,transform:`scale(${lerp(.7,1,o)})`,transformOrigin:id==="b2"?"20% 100%":"100% 50%"}); }
|
| 353 |
+
// the misbaha swings; on the verdict its next bead turns gold, with a sparkle
|
| 354 |
+
if(car>0){ $("mis").setAttribute("transform",`rotate(${5*Math.sin(t*2.4)} 540 500)`);
|
| 355 |
+
const beads=$("mis").querySelectorAll(".bead"), v=S(M.verdict.t), lit=ease((t-v)/.3), b=beads[MIS.gold];
|
| 356 |
+
b.setAttribute("fill",lit>0?`rgb(${Math.round(lerp(46,226,lit))},${Math.round(lerp(156,169,lit))},${Math.round(lerp(156,59,lit))})`:"#2E9C9C");
|
| 357 |
+
const sp=ease((t-v)/.7); Object.assign($("sparkle").style,{}); $("sparkle").setAttribute("cx",b.getAttribute("cx")); $("sparkle").setAttribute("cy",b.getAttribute("cy"));
|
| 358 |
+
$("sparkle").setAttribute("r",14+40*sp); $("sparkle").setAttribute("opacity",t>v?(1-sp):0);
|
| 359 |
+
let cord=""; beads.forEach((c,i)=>{ cord+=(i?"L":"M")+c.getAttribute("cx")+" "+c.getAttribute("cy"); }); $("misCord").setAttribute("d","M540 498 "+cord.replace(/^M/,"L")+" L540 498 M540 695 L540 716"); }
|
| 360 |
+
// the grid: it takes over from the phone, then each tile in turn comes forward and plays its example
|
| 361 |
+
const gv=win(t,S(M.w0.t)+.3,S(M.m1.t)+.15,.3);
|
| 362 |
+
$("grid").style.visibility=gv>0?"visible":"hidden";
|
| 363 |
+
let zmax=0;
|
| 364 |
+
if(gv>0){
|
| 365 |
+
const zs=TILES.map(([id,k])=>{ const a=S(M[k+"0"].t), b=S(M[k+"1"].t), i0=k==="w"?a+1.5:a; // the first: after the whole grid has been seen
|
| 366 |
+
return Math.max(0,Math.min(ease((t-i0)/.5),1-ease((t-(b-.5))/.5))); });
|
| 367 |
+
zmax=Math.max(...zs);
|
| 368 |
+
for(let i=0;i<TILES.length;i++){ const [id,k,x,y,ry]=TILES[i], z=zs[i], el=$(id);
|
| 369 |
+
const a=M[k+"0"].t, b=M[k+"1"].t, img=el.querySelector("img"), f=frameAt(Math.max(a+.5,Math.min(b,s))); // from inside: the first frames after a cut can still be the scene before
|
| 370 |
+
if(img.dataset.f!==f){ img.src=f; await img.decode().catch(()=>{}); img.dataset.f=f; }
|
| 371 |
+
const intro=ease((t-S(M.w0.t)-.25-i*.12)/.35); // the tiles come in one by one
|
| 372 |
+
const dx=lerp(0,540-(x+175),z), dy=lerp(0,1160-(y+370),z), k2=lerp(1,1.75,z);
|
| 373 |
+
el.style.transform=`translate3d(${dx}px,${dy}px,${z*50}px) rotateY(${lerp(ry,0,z)}deg) scale(${k2*lerp(.85,1,intro)})`;
|
| 374 |
+
el.style.left=x+"px"; el.style.top=y+"px"; el.style.zIndex=z>0?10:1;
|
| 375 |
+
el.style.opacity=Math.min(intro, 1-.95*Math.max(0,zmax-z)) * gv;
|
| 376 |
+
el.querySelector(".lab").style.opacity=1-z; }
|
| 377 |
+
}
|
| 378 |
+
// the phone goes into the grid's first tile and comes back for the summary
|
| 379 |
+
const ph=1-win(t,S(M.w0.t)+.45,S(M.m1.t)-.05,.15);
|
| 380 |
+
$("phone").style.opacity=ph; $("shadow").style.opacity=parseFloat($("shadow").style.opacity||1)*ph;
|
| 381 |
+
// the band behind the headlines: up a little in the car (the mirror shows), away over the grid's overview
|
| 382 |
+
$("band").style.transform=`translateY(${-120*car}px)`;
|
| 383 |
+
$("band").style.opacity=(gv>0?zmax:1)*ease((t-BOOK0-.5)/.4); // none in the opening: it would fade the top of the logo
|
| 384 |
// the ring on the red letter: after the camera has moved in, until the tip opens
|
| 385 |
const r=win(t,S(M.score.t)+.9,S(M.tap.t)+.25,.25);
|
| 386 |
if(r>0){ const b=M.letter.box, p0=onPhone(b[0],b[1]), w=b[2]*SCREEN.w*p.k, h=b[3]*SCREEN.h*p.k, pad=14;
|
|
|
|
| 389 |
transform:`scale(${1+.06*Math.sin((t-S(M.score.t))*7)})`}); }
|
| 390 |
else $("ring").style.opacity=0;
|
| 391 |
// the consonants, one by one; then the logo, its whole animation
|
| 392 |
+
$("outro").style.display="none"; // the consonants' card is out: the summary sums up
|
| 393 |
+
$("car").style.display=car>0?"block":"none"; $("wheel").style.display=car>0?"block":"none";
|
| 394 |
const L=S(END)+CHIPS;
|
| 395 |
+
$("logo").style.opacity=ease((t-L+.2)/.4); $("logo").style.visibility=t>L-.2?"visible":"hidden";
|
| 396 |
+
LOGO_ANIMS.forEach(a=>{ a.currentTime=Math.max(0,t-L)*1000*LOGO_SPEED; }); // the whole animation, a little quicker
|
| 397 |
+
$("logo").querySelector(".cta").style.opacity=ease((t-L-5.6)/.5);
|
| 398 |
+
$("logo").querySelector(".cta").style.transform=`translateY(${(1-ease((t-L-5.6)/.5))*24}px)`;
|
| 399 |
+
|
|
|
|
| 400 |
}
|
| 401 |
</script>
|
| 402 |
</body>
|
scripts/demo_video/promo.py
CHANGED
|
@@ -122,12 +122,9 @@ async def record_screen(url, takes, work):
|
|
| 122 |
# and listens, then says the verdict
|
| 123 |
pause()
|
| 124 |
await pg.evaluate("store.set('ihki.driveSeen',true)") # past the first-time explanation
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
break
|
| 129 |
-
await pg.click("#nextBtn"); await wait(300)
|
| 130 |
-
await pg.evaluate("scrollTo(0,0)")
|
| 131 |
await pg.click("#driveBtn"); await wait(150)
|
| 132 |
resume()
|
| 133 |
await mark("drive")
|
|
@@ -138,32 +135,80 @@ async def record_screen(url, takes, work):
|
|
| 138 |
if (await status()).startswith("ืชืืจืื"):
|
| 139 |
break
|
| 140 |
await wait(50)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
resume()
|
| 142 |
await mark("turn")
|
| 143 |
-
await wait(
|
| 144 |
await pg.evaluate("t=>__demo.play(t)", "c876")
|
| 145 |
for _ in range(400):
|
| 146 |
if (await status()).startswith("ืฆืืื"):
|
| 147 |
break
|
| 148 |
await wait(50)
|
| 149 |
await mark("verdict")
|
| 150 |
-
print(" driving:", await status())
|
| 151 |
await wait(1500)
|
| 152 |
await mark("driveEnd")
|
| 153 |
pause()
|
| 154 |
await pg.evaluate("stopDrive()")
|
| 155 |
|
| 156 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
await pg.locator("button", has_text="ืืืจื ืืืกืืื").first.click(); await wait(600)
|
| 158 |
-
|
| 159 |
-
await
|
| 160 |
-
resume()
|
| 161 |
-
await
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
await wait(400)
|
| 163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
await tap(f'.mg-bead.he:has-text("{he}")', 200)
|
| 165 |
await tap(f'.mg-bead.ar:has-text("{ar}")', 480)
|
| 166 |
-
await wait(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
await mark("end")
|
| 168 |
await cdp.send("Page.stopScreencast")
|
| 169 |
await asyncio.sleep(0.3)
|
|
@@ -180,7 +225,7 @@ async def render(frames, marks, work, out):
|
|
| 180 |
|
| 181 |
async def serve(route):
|
| 182 |
path = route.request.url.split("promo.local/", 1)[1].split("?")[0]
|
| 183 |
-
f = HERE / path if path
|
| 184 |
if path == "logo-intro.svg":
|
| 185 |
f = HERE.parents[1] / "static" / "logo-intro.svg"
|
| 186 |
await route.fulfill(path=str(f))
|
|
|
|
| 122 |
# and listens, then says the verdict
|
| 123 |
pause()
|
| 124 |
await pg.evaluate("store.set('ihki.driveSeen',true)") # past the first-time explanation
|
| 125 |
+
# still on "ืืืืจ" (re-opening the topic would start a round without it: it was just passed)
|
| 126 |
+
await pg.evaluate("cancelAutoNext(); show(cur,true); scrollTo(0,0)") # fresh: no old score, no countdown to the next verb
|
| 127 |
+
await wait(400)
|
|
|
|
|
|
|
|
|
|
| 128 |
await pg.click("#driveBtn"); await wait(150)
|
| 129 |
resume()
|
| 130 |
await mark("drive")
|
|
|
|
| 135 |
if (await status()).startswith("ืชืืจืื"):
|
| 136 |
break
|
| 137 |
await wait(50)
|
| 138 |
+
for _ in range(200): # after its beep the app starts recording: only then the answer
|
| 139 |
+
if await pg.evaluate("typeof rec!=='undefined'&&rec&&rec.state==='recording'"):
|
| 140 |
+
break
|
| 141 |
+
await wait(50)
|
| 142 |
resume()
|
| 143 |
await mark("turn")
|
| 144 |
+
await wait(250)
|
| 145 |
await pg.evaluate("t=>__demo.play(t)", "c876")
|
| 146 |
for _ in range(400):
|
| 147 |
if (await status()).startswith("ืฆืืื"):
|
| 148 |
break
|
| 149 |
await wait(50)
|
| 150 |
await mark("verdict")
|
| 151 |
+
print(" driving:", await status(), "ยท", await pg.inner_text("#prompt"))
|
| 152 |
await wait(1500)
|
| 153 |
await mark("driveEnd")
|
| 154 |
pause()
|
| 155 |
await pg.evaluate("stopDrive()")
|
| 156 |
|
| 157 |
+
# the grid of other ways to practice, lesson 4: four short examples, each with a still half second at its
|
| 158 |
+
# start and end (the camera moves in and out on those)
|
| 159 |
+
async def path():
|
| 160 |
+
await pg.locator("#nav button", has_text="ืืกืืื").first.click(); await wait(500)
|
| 161 |
+
|
| 162 |
+
pause() # new words: a card, revealed, "ืืืขืชื"
|
| 163 |
await pg.locator("button", has_text="ืืืจื ืืืกืืื").first.click(); await wait(600)
|
| 164 |
+
sat = pg.locator("button.sat", has_text="ืืืืื ืืืฉืืช").nth(3)
|
| 165 |
+
await sat.scroll_into_view_if_needed(); await sat.click(); await wait(1200)
|
| 166 |
+
resume(); await mark("w0")
|
| 167 |
+
await wait(2000) # the whole grid first, then the camera moves in
|
| 168 |
+
await tap("#learnShow", 1000)
|
| 169 |
+
await tap("#learnKnow", 300)
|
| 170 |
+
await wait(300); await mark("w1")
|
| 171 |
+
pause(); await pg.click("#learnClose"); await wait(500)
|
| 172 |
+
|
| 173 |
+
sat = pg.locator("button.sat", has_text="ืืชืืืื ืืืืืช").nth(3) # pairs: two matched
|
| 174 |
+
await sat.scroll_into_view_if_needed(); await sat.click(); await wait(1300)
|
| 175 |
+
resume(); await mark("p0")
|
| 176 |
+
await wait(350)
|
| 177 |
+
ids = await pg.evaluate("[...document.querySelectorAll('.mtile[data-side=he]')].map(t=>t.dataset.id)")
|
| 178 |
+
for i in ids[:2]:
|
| 179 |
+
await tap(f'.mtile[data-side="he"][data-id="{i}"]', 180)
|
| 180 |
+
await tap(f'.mtile[data-side="tr"][data-id="{i}"]', 500)
|
| 181 |
+
await wait(300); await mark("p1")
|
| 182 |
+
pause(); await pg.click("#matchClose"); await wait(500)
|
| 183 |
+
|
| 184 |
+
sat = pg.locator("button.sat", has_text="ืกืืคืืจ: ืฉืื ื ืืืืฉ").first # a story, read aloud line by line
|
| 185 |
+
await sat.scroll_into_view_if_needed(); await sat.click(); await wait(1100)
|
| 186 |
+
await pg.evaluate("scrollTo(0,0)"); await wait(300)
|
| 187 |
+
resume(); await mark("s0")
|
| 188 |
await wait(400)
|
| 189 |
+
await tap("#hearBtn", 0)
|
| 190 |
+
await wait(2200); await mark("s1")
|
| 191 |
+
pause(); await pg.click("#hearBtn"); await wait(300)
|
| 192 |
+
await pg.locator("button", has_text="ืืืจื ืืืกืืื").first.click(); await wait(600)
|
| 193 |
+
|
| 194 |
+
await pg.locator("#nav button", has_text="ืืฉืืงืื").first.click(); await wait(600) # "ืืคืืขื ืืืจืื": two pairs
|
| 195 |
+
await pg.locator("#vids button", has_text="ืืคืืขื ืืืจืื").first.click(); await wait(1200)
|
| 196 |
+
resume(); await mark("m0")
|
| 197 |
+
await wait(350)
|
| 198 |
+
for he, ar in [("ืคืชื", "ืคึทืชึทื"), ("ืืื", "ืึทืึทึผื")]:
|
| 199 |
await tap(f'.mg-bead.he:has-text("{he}")', 200)
|
| 200 |
await tap(f'.mg-bead.ar:has-text("{ar}")', 480)
|
| 201 |
+
await wait(750); await mark("m1") # the camera moves back out to the grid
|
| 202 |
+
|
| 203 |
+
# the summary: "the Arabic that's already yours", what this session collected
|
| 204 |
+
pause()
|
| 205 |
+
await pg.locator(".mg-close").first.click(); await wait(500)
|
| 206 |
+
await pg.locator("#nav button", has_text="ืืกืืื").first.click(); await wait(600)
|
| 207 |
+
await pg.evaluate("scrollTo(0,0)"); await wait(300)
|
| 208 |
+
await pg.click("#rewardShelf"); await wait(900)
|
| 209 |
+
resume()
|
| 210 |
+
await mark("shelf")
|
| 211 |
+
await wait(4600)
|
| 212 |
await mark("end")
|
| 213 |
await cdp.send("Page.stopScreencast")
|
| 214 |
await asyncio.sleep(0.3)
|
|
|
|
| 225 |
|
| 226 |
async def serve(route):
|
| 227 |
path = route.request.url.split("promo.local/", 1)[1].split("?")[0]
|
| 228 |
+
f = HERE / path if path == "promo.html" or path.startswith("assets/") else work / path
|
| 229 |
if path == "logo-intro.svg":
|
| 230 |
f = HERE.parents[1] / "static" / "logo-intro.svg"
|
| 231 |
await route.fulfill(path=str(f))
|
static/assets/pronunciation-rules.md
CHANGED
|
@@ -369,6 +369,7 @@ scoring:
|
|
| 369 |
| 29 | ืชื ืืขื ืงืฆืจื ืืกืืฃ ืืืื ื ืจืืืช ืืืืงื ืืคื ื ืชื ืืขื ืืชืืืืช ืืืืื ืืืื | ืืืืืืจ ืืืืืจ ืืืขืืจ ืฉืืื ืืงืืกืืืช ืืฉืชื ืืืืืื, ืืื CTC ืขืฉืื ืืฉืืื ืืืชื ืจืง ืืืืช: `สala สiidak` | ืชื ืืขื ืงืฆืจื ืืืืงื ืืกืืฃ ืืืื ืืคื ื V ืื ส+V ืืงืืืช ืืคืืืช 90. ืืืืฆืข ืืืื ืื ืืคื ื ืขืืฆืืจ ืืื ืคืืืจ |
|
| 370 |
| 30 | ืชื ืืขื ืงืฆืจื ืืื ื ืืกืืื ืช ืื ืฆืืื ืืงืืกืื ื ืืื ืฉืื ืืืจืื ืืช ืืืืื | ืืฆืื ืืืืฉืื ืืืืืื ืืืืฉื ืืืชื ืืืื ืืืช; ืืื ืืืืืื ืโืื ืกืืืโ ืขื ืฆืืื 1 | ืชื ืืขื ืงืฆืจื ืฉืืื ื ื ืืืงืช ืืงืืืช ืืคืืืช 90. `u` ืืืจื ืขืืฆืืจ ืืืืชื ืืืื ื ืฉืืจืช ื ืืืงืช ืืคื 3.11 |
|
| 371 |
| 31 | ืืขืืฆืืจ ืืจืืฉืื ืืืฉืคื ืืืฉ, ืืืชืืจื ืืืคืืข ืืคื ืื ืืคืจืืื ืืื ืืืื | ืคืืฆืฅ ืืชืืืืช ืืืข (ืกืืจ ืฉืงื ืืคืืฆืืฅ ืงืฆืจ) ื ืฉืืข ืืืฉ ืืืืื, ืื ืฉืืื ืื ืจืขืฉ ืืืงืจืืคืื ืืคืจืืื ืืืื ืืืืจืื ืขืืื ืืฉื ืฉืจืืจืืชื: `ุทุงููุชูุง`, tหค ืฉื ืฉืืขื ืึพj | ืขืืฆืืจ ืจืืฉืื ืฉื ืฉืืข (ืื ืืืืง, ืฉืื โฅ 5%) ืืืชืืจื ืืคืจืืื ืืื ืืืื: ืืคืืืช 90, ืื ืืกืืื. ืืฉืืื, ืื ืืชืืจื ืืฉื ื ืคืจืืืืื ืืืขืื, ื ืืืงืื ืืจืืื. ส ืืืืคืืช ืืืืืื 1โ2 |
|
|
|
|
| 372 |
|
| 373 |
ืืืืืจ ืืชืจืืื `ุงูุง` ืืืืฆืืช ืืืคืืจืฉ ืืฉื ื ืืจืืื ืืื ืชืงืื ืื, `ส a n a` ืึพ`a n a`. ืื ืืฉืืื ืืืขืืช ื ืืืจืช ืืืืจืืื ื ืืื ืืืงืื ืืืืฉืจ ืืืื ืืช ืชืืืืช ืืืงืืื ืืื ส ืืืคืจืฉ ืจืขืฉ ื ืฉืืื ืึพ`h`.
|
| 374 |
|
|
|
|
| 369 |
| 29 | ืชื ืืขื ืงืฆืจื ืืกืืฃ ืืืื ื ืจืืืช ืืืืงื ืืคื ื ืชื ืืขื ืืชืืืืช ืืืืื ืืืื | ืืืืืืจ ืืืืืจ ืืืขืืจ ืฉืืื ืืงืืกืืืช ืืฉืชื ืืืืืื, ืืื CTC ืขืฉืื ืืฉืืื ืืืชื ืจืง ืืืืช: `สala สiidak` | ืชื ืืขื ืงืฆืจื ืืืืงื ืืกืืฃ ืืืื ืืคื ื V ืื ส+V ืืงืืืช ืืคืืืช 90. ืืืืฆืข ืืืื ืื ืืคื ื ืขืืฆืืจ ืืื ืคืืืจ |
|
| 370 |
| 30 | ืชื ืืขื ืงืฆืจื ืืื ื ืืกืืื ืช ืื ืฆืืื ืืงืืกืื ื ืืื ืฉืื ืืืจืื ืืช ืืืืื | ืืฆืื ืืืืฉืื ืืืืืื ืืืืฉื ืืืชื ืืืื ืืืช; ืืื ืืืืืื ืโืื ืกืืืโ ืขื ืฆืืื 1 | ืชื ืืขื ืงืฆืจื ืฉืืื ื ื ืืืงืช ืืงืืืช ืืคืืืช 90. `u` ืืืจื ืขืืฆืืจ ืืืืชื ืืืื ื ืฉืืจืช ื ืืืงืช ืืคื 3.11 |
|
| 371 |
| 31 | ืืขืืฆืืจ ืืจืืฉืื ืืืฉืคื ืืืฉ, ืืืชืืจื ืืืคืืข ืืคื ืื ืืคืจืืื ืืื ืืืื | ืคืืฆืฅ ืืชืืืืช ืืืข (ืกืืจ ืฉืงื ืืคืืฆืืฅ ืงืฆืจ) ื ืฉืืข ืืืฉ ืืืืื, ืื ืฉืืื ืื ืจืขืฉ ืืืงืจืืคืื ืืคืจืืื ืืืื ืืืืจืื ืขืืื ืืฉื ืฉืจืืจืืชื: `ุทุงููุชูุง`, tหค ืฉื ืฉืืขื ืึพj | ืขืืฆืืจ ืจืืฉืื ืฉื ืฉืืข (ืื ืืืืง, ืฉืื โฅ 5%) ืืืชืืจื ืืคืจืืื ืืื ืืืื: ืืคืืืช 90, ืื ืืกืืื. ืืฉืืื, ืื ืืชืืจื ืืฉื ื ืคืจืืืืื ืืืขืื, ื ืืืงืื ืืจืืื. ส ืืืืคืืช ืืืืืื 1โ2 |
|
| 372 |
+
| 32 | t ื ืฉืืขื ืึพd, ืื d ืึพt | ืืขืืจืืช ืืฉ ืืืชื ืืืื ื (ืช / ื), ืืืืืืื ืืืขื ืื ืืืืืคืื ืืื ืืื. ืืืืื ืืจืึพืืฉืื ื ืื: t ืืืจื n (`ุงูุชู`) ืื ืืื ืชื ืืขืืช (`ูุชุญ`) ืืงืืืช ืงืืืืืช ืืืงืืช ืืืืืืจ ืืืขื ืื ืฉืืขืช ืื d | `tโd` ืึพ`dโt` ืืงืืืืช 100. ืขืืฆืืจืื ืืืืืฉืื (tหค, dหค) ืื ืืืื ืืื ืื ืืืงืื ืืคื 3.3 |
|
| 373 |
|
| 374 |
ืืืืืจ ืืชืจืืื `ุงูุง` ืืืืฆืืช ืืืคืืจืฉ ืืฉื ื ืืจืืื ืืื ืชืงืื ืื, `ส a n a` ืึพ`a n a`. ืื ืืฉืืื ืืืขืืช ื ืืืจืช ืืืืจืืื ื ืืื ืืืงืื ืืืืฉืจ ืืืื ืืช ืชืืืืช ืืืงืืื ืืื ส ืืืคืจืฉ ืจืขืฉ ื ืฉืืื ืึพ`h`.
|
| 375 |
|
static/index.html
CHANGED
|
@@ -346,17 +346,17 @@ body.memory-game{overflow:hidden}
|
|
| 346 |
@keyframes td-pop{from{transform:scale(0) rotate(-20deg);opacity:0}to{transform:none;opacity:1}}
|
| 347 |
@keyframes td-wobble{0%,70%,100%{transform:none}76%{transform:rotate(-14deg) scale(1.08)}84%{transform:rotate(12deg) scale(1.08)}92%{transform:rotate(-6deg)}}
|
| 348 |
@media (prefers-reduced-motion:reduce){.td-medal,.td-stars span.on,.td-bead,.td-bead.weak{animation:none}}
|
| 349 |
-
.reward-shelf{width:100%;max-width:460px;margin:
|
| 350 |
-
.reward-shelf:hover{
|
| 351 |
.streak-ring{width:50px;height:50px;border-radius:50%;display:grid;place-items:center;background:var(--amber-bg);border:2px solid var(--orange);color:var(--orange);font:700 16px/1 var(--f-body);box-shadow:0 2px 0 color-mix(in srgb,var(--orange) 55%,var(--line))}
|
| 352 |
-
.reward-copy{display:flex;min-width:0;flex-direction:column;line-height:1.25}.reward-copy b{font-size:
|
| 353 |
body:not(.home) .reward-shelf,body.manage .reward-shelf,body[data-view] .reward-shelf{display:none}
|
| 354 |
-
#rewardsDlg{width:min(94vw,520px);max-height:88vh}.reward-summary{display:grid;grid-template-columns:repeat(
|
| 355 |
-
.reward-lesson{margin:18px 0 0;padding:8px 0 5px;border-bottom:1px solid var(--line);color:var(--olive);font:400 20px/1.2 var(--f-display)}.reward-lesson:first-child{margin-top:8px}.reward-topic{margin:10px 0 5px;font:700 15px/1.2 var(--f-body)}.reward-topic small{margin-inline-start:6px;color:var(--muted)}.reward-beads{display:flex;flex-wrap:wrap;gap:7px;direction:rtl}.phrase-bead{width:31px;height:31px;border-radius:50%;border:3px solid #52624b;background:radial-gradient(circle at 32% 27%,#dce7d4 0 9%,#769064 23%,#405136 72%);box-shadow:inset -2px -3px 3px rgb(0 0 0/.3),0 2px 2px rgb(0 0 0/.2);cursor:pointer}.phrase-bead.gold{border-color:#9b690b;background:radial-gradient(circle at 32% 27%,#fff3a7 0 9%,#e4b83e 27%,#9d6509 75%)}
|
| 356 |
.reward-empty{padding:20px;border:1px dashed var(--line);border-radius:12px;color:var(--muted);text-align:center}
|
| 357 |
-
.reward-pop{position:fixed;z-index:60;left:50%;top:18%;width:min(88vw,360px);transform:translate(-50%,-12px) scale(.96);padding:14px 18px;border:1px solid var(--olive);border-radius:16px;background:var(--surface);color:var(--ink);box-shadow:0 12px 38px rgb(0 0 0/.28);text-align:center;opacity:0;pointer-events:none;transition:opacity .18s,transform .18s}.reward-pop.show{opacity:1;transform:translate(-50%,0) scale(1)}.reward-pop b{display:block;color:var(--olive);font:400 22px/1.25 var(--f-display)}.reward-pop.gold b{color:var(--amber)}.reward-pop small{color:var(--muted);font-weight:600}
|
| 358 |
@media (prefers-reduced-motion:reduce){.reward-pop{transition:none}}
|
| 359 |
-
@media (max-width:430px){.reward-summary{grid-template-columns:repeat(2,1fr)}}
|
| 360 |
.path{--track:color-mix(in srgb,var(--muted) 75%,var(--bg));position:relative;width:100%;max-width:460px;margin:4px auto 72px;background:#101510 url("/static/assets/arabic-calligraphy-path.webp?v=7") top center/100% auto repeat-y}
|
| 361 |
.road{position:absolute;left:50%;top:0;width:1px;height:100%;overflow:visible;pointer-events:none}
|
| 362 |
.road path{fill:none;stroke-linecap:round}
|
|
@@ -483,6 +483,10 @@ html.a11y-contrast{--e-a:#d8b4ff;--e-t:#8fd0ff;--e-y:#70ff9b;--e-n:#ffb45b;--e-s
|
|
| 483 |
}
|
| 484 |
@media (max-width:360px){.eitan-chips{grid-template-columns:repeat(2,minmax(0,1fr))}.eitan-legend span{font-size:10px}.eitan-body{font-size:24px}}
|
| 485 |
.card{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:14px 16px;display:flex;flex-direction:column;gap:10px}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 486 |
.meta{display:flex;justify-content:space-between;color:var(--muted);font-size:13px;letter-spacing:.04em;font-variant-numeric:tabular-nums}
|
| 487 |
.meta .idx{background:var(--olive-soft);color:var(--olive);font-weight:700;padding:1px 10px;border-radius:999px}
|
| 488 |
.progress{height:4px;border-radius:999px;background:var(--line);overflow:hidden;margin-top:-4px}
|
|
@@ -536,7 +540,7 @@ html.a11y-contrast{--e-a:#d8b4ff;--e-t:#8fd0ff;--e-y:#70ff9b;--e-n:#ffb45b;--e-s
|
|
| 536 |
.mic.live::after{content:"";position:absolute;inset:-6px;border-radius:50%;border:3px solid var(--sumac);opacity:.5;animation:pulse 1.2s ease-out infinite}
|
| 537 |
.mic:disabled{opacity:.5;cursor:progress}
|
| 538 |
@keyframes pulse{from{transform:scale(.9);opacity:.6}to{transform:scale(1.15);opacity:0}}
|
| 539 |
-
@media (prefers-reduced-motion:reduce){.mic.live::after{animation:none}}
|
| 540 |
.status{font-size:14px}
|
| 541 |
/* A phrase to read has two microphones side by side: the Arabic one (filled; the reading is scored) and the Hebrew one
|
| 542 |
(outlined; the translation is checked). Each carries its language's letter and a line under it saying what it does. */
|
|
@@ -1022,13 +1026,17 @@ body.driving .drive{background:var(--sumac);border-color:var(--sumac);color:#fff
|
|
| 1022 |
/* driving mode: nothing to read or press but the stop button */
|
| 1023 |
body.driving .roundbar,body.driving .row,body.driving .voicebox,body.driving .task{display:none}
|
| 1024 |
body.driving .prompt{font-size:clamp(30px,8vw,48px)}
|
|
|
|
|
|
|
| 1025 |
body.driving .status{font-size:20px;font-weight:700;color:var(--ink)}
|
| 1026 |
body.driving .mic{width:84px;height:84px}
|
|
|
|
| 1027 |
.voicebox{display:flex;flex-direction:column;font-size:16px}
|
| 1028 |
.voicebox label{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:48px;border-bottom:1px solid var(--line);cursor:pointer}
|
| 1029 |
.voicebox label:last-child{border-bottom:0}
|
| 1030 |
.voicebox input,.donebox input{width:20px;height:20px;accent-color:var(--olive)}
|
| 1031 |
-
#setDlg,#driveDlg{width:min(92vw,380px)}
|
|
|
|
| 1032 |
.dlg-text{margin:4px 0 14px;font-size:16px}
|
| 1033 |
.voicebox select{font:600 14px var(--f-body);padding:4px 8px;border-radius:8px;border:1px solid var(--line);background:var(--surface);color:var(--ink)}
|
| 1034 |
.warn{background:var(--amber-bg);color:var(--amber);border-radius:10px;padding:10px 12px;font-size:14px}
|
|
@@ -1412,7 +1420,12 @@ html.a11y-reduce-motion *,html.a11y-reduce-motion *::before,html.a11y-reduce-mot
|
|
| 1412 |
<button class="reward-shelf" id="rewardShelf" type="button" hidden>
|
| 1413 |
<span class="streak-ring" id="rewardStreak">๐ฅ 0</span>
|
| 1414 |
<span class="reward-copy"><b>ืืขืจืืืช ืฉืืืจ ืฉืืื</b><small id="rewardCopy">ืขืื ืื ื ืืกืคื ืืฉืคืืื</small></span>
|
| 1415 |
-
<span class="reward-totals">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1416 |
</button>
|
| 1417 |
<section id="vids" aria-live="polite"></section>
|
| 1418 |
<nav id="nav" aria-label="ื ืืืื"><button data-view="">ืืกืืื</button><button data-view="live">ืฉืืขืืจ ืื</button><button data-view="verbs">ืคืขืืื</button><button data-view="games" hidden>ืืฉืืงืื</button><button data-view="refer">ืืืจ ืืืื ืืืจ</button></nav>
|
|
@@ -1435,6 +1448,10 @@ html.a11y-reduce-motion *,html.a11y-reduce-motion *::before,html.a11y-reduce-mot
|
|
| 1435 |
<div id="envWarn" class="warn" hidden></div>
|
| 1436 |
|
| 1437 |
<main class="card" id="card" aria-live="polite">
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1438 |
<div class="bubble-score" id="bubbleScore" hidden><span>ื ืืงืื<small id="bubbleCount"></small></span><b id="bubblePoints">0</b></div>
|
| 1439 |
<div class="bubble-best" id="bubbleBest" hidden><span>๐ ืฉืื</span><b id="bubbleBestPoints">โ</b></div>
|
| 1440 |
<button class="bubble-help" id="bubbleHelp" type="button" aria-label="ืื ืืืืช ืืืฉืืง" title="ืื ืืืืช ืืืฉืืง" hidden>?</button>
|
|
@@ -1452,6 +1469,9 @@ html.a11y-reduce-motion *,html.a11y-reduce-motion *::before,html.a11y-reduce-mot
|
|
| 1452 |
<button class="mic" id="mic" data-lang="ุน" aria-label="ืืงืืืื ืืช ืืชืฉืืื">
|
| 1453 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="2" width="6" height="12" rx="3" fill="currentColor"/><path d="M5 11a7 7 0 0 0 14 0M12 18v4M8 22h8"/></svg>
|
| 1454 |
</button>
|
|
|
|
|
|
|
|
|
|
| 1455 |
<button class="btn phone-btn" id="phoneBtn" title="ืืฉืืืืช ืจืฆืฃ ืืคืื ืืืช ืืฆืคืื ืืื ืฉืืืืื ืฉืืข" aria-label="ื ืืชืื ืคืื ืืืช" hidden disabled>/fษ/</button>
|
| 1456 |
<div class="status" id="status">ืืืฆื ืืืืจื. ืืืงืืื ื ืขืฆืจืช ืืื ืืฉืืกืืืืื</div>
|
| 1457 |
<button class="btn" id="quietBtn" title="ืชืจืืื ืืื ืืืงืจืืคืื: ืืจืืืืื ืืช ืืืฉืคื ืืขืจืืืช ืืืืืื. ืื ื ืจืฉื ืฆืืื">ืชืจืืื ืฉืงื ืืื ืฆืืื</button>
|
|
@@ -1712,7 +1732,7 @@ html.a11y-reduce-motion *,html.a11y-reduce-motion *::before,html.a11y-reduce-mot
|
|
| 1712 |
</dialog>
|
| 1713 |
<dialog id="rewardsDlg" aria-labelledby="rewardsTitle">
|
| 1714 |
<div class="dlg-head"><h2 id="rewardsTitle">ืืขืจืืืช ืฉืืืจ ืฉืืื</h2><button class="btn" id="rewardsClose">ืกืืืจื</button></div>
|
| 1715 |
-
<p class="dlg-text">ืื
|
| 1716 |
<div class="reward-summary" id="rewardSummary"></div>
|
| 1717 |
<div id="rewardCollection"></div>
|
| 1718 |
</dialog>
|
|
@@ -1722,6 +1742,14 @@ html.a11y-reduce-motion *,html.a11y-reduce-motion *::before,html.a11y-reduce-mot
|
|
| 1722 |
<p class="dlg-text">ืชืจืืื ืืื ืืืขืช ืืืกื: ืืืคืืืงืฆืื ืืงืจืืื ืื ืืฉืคื, ืืฆืคืฆืคืช ืืฉืชืืจืื ืืืืจ, ืืืืืจืช ืืงืื ืื ืืฆืืืชื. ืืฉืื ืืฆืืืชื ืฉืืืขืื ืืช ืืชืฉืืื ืืื ืกืื ืคืขื ืืืช ื ืืกืคืช. ืืกืืฃ ืื ืืฉื ืฉืืืืช ืื ืืขืืืจ ืื ืืฉื ืืื. ืื ืื ืขืื ืื ืคืขืืืื ืืจืฆืฃ, ืืืฆื ื ืขืฆืจ ืืื. ืืกืืื ืืืืฆืื ืขื "ืกืืื ื ืกืืขื".</p>
|
| 1723 |
<div class="row"><button class="btn primary" id="driveGo">ืืชืืืื</button><button class="btn" id="driveNo">ืื ืขืืฉืื</button></div>
|
| 1724 |
</dialog>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1725 |
<dialog id="bubbleGuideDlg" aria-labelledby="bubbleGuideTitle">
|
| 1726 |
<div class="dlg-head"><h2 id="bubbleGuideTitle">ืืื ืืฉืืงืื ืืคืืขื ืืื ื?</h2><button class="btn" id="bubbleGuideClose">ืกืืืจื</button></div>
|
| 1727 |
<p class="dlg-text">ืืื ืกืืืื ืืืคืืข ืคืืขื ืืขืืจืืช ืืชืื ืืจืื. ืืืจื ืืืชื ืืขืจืืืช ืืืืืจืช โ ืืขืืจ ืืื ืืขืชืื โ ืืคื ื ืฉืืืขืช ืืืื ื ืขืืืช.</p>
|
|
@@ -2715,12 +2743,14 @@ function drawLiveStudent(s){
|
|
| 2715 |
}
|
| 2716 |
async function liveRecord(){
|
| 2717 |
if(LIVE.rec&&LIVE.rec.state==="recording"){ LIVE.rec.stop(); return; }
|
|
|
|
| 2718 |
let stream; try{ stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:true,noiseSuppression:true}}); }catch{ $("liveStatus").textContent="ืืื ืืืฉื ืืืืงืจืืคืื"; return; }
|
| 2719 |
const chunks=[], type=pickType(); LIVE.rec=new MediaRecorder(stream,type?{mimeType:type}:{}); LIVE.busy=true;
|
| 2720 |
LIVE.rec.ondataavailable=e=>{if(e.data.size)chunks.push(e.data)}; LIVE.rec.onstart=()=>{ $("liveMic").classList.add("recording"); $("liveStatus").textContent="ืืงืืืโฆ ืืืฆื ืืกืืื"; };
|
| 2721 |
LIVE.rec.onstop=async()=>{ stream.getTracks().forEach(t=>t.stop()); const blob=new Blob(chunks,{type:LIVE.rec.mimeType||"audio/webm"}), fd=new FormData(); fd.append("audio",blob,"live"); $("liveStatus").textContent="ืืืืงืืโฆ";
|
| 2722 |
try{ const res=await api(`/api/live/${LIVE.code}/answer`,{method:"POST",body:fd}), data=await res.json().catch(()=>({})); if(!res.ok) throw new Error(data.detail||res.status); }catch(err){ $("liveStatus").textContent=`ืื ืืฆืืื ื ืืืืืง: ${err.message}`; }
|
| 2723 |
LIVE.busy=false; LIVE.rec=null; loadLiveSession(); };
|
|
|
|
| 2724 |
LIVE.rec.start(); setTimeout(()=>LIVE.rec&&LIVE.rec.state==="recording"&&LIVE.rec.stop(),10000);
|
| 2725 |
}
|
| 2726 |
const referTab=$("nav").querySelector('[data-view="refer"]'), referSeenKey="ihki.referSeen.2027";
|
|
@@ -2795,25 +2825,54 @@ function rewardItems(){
|
|
| 2795 |
}
|
| 2796 |
return items;
|
| 2797 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2798 |
function drawRewardShelf(){
|
| 2799 |
const shelf=$("rewardShelf"); if(!PHRASES.length){ shelf.hidden=true; return; }
|
| 2800 |
-
const got=rewardItems(), gold=got.filter(x=>x.gold).length, wd=currentWeekDays(), streak=combinedStreak(), goal=4;
|
| 2801 |
$("rewardStreak").textContent=`๐ฅ ${streak.current}`; $("rewardStreak").title=`ืจืฆืฃ ื ืืืื: ${streak.current} ืืืื ยท ืฉืื ืืืฉื: ${streak.best}`;
|
| 2802 |
-
$("rewardCopy").textContent=streak.current?`ืจืฆืฃ ืฉื ${streak.current} ืืืื ยท ืฉืื ${streak.best}
|
| 2803 |
$("rewardWeek").textContent=`${Math.min(wd,goal)}/${goal} ืืฉืืืข`;
|
| 2804 |
-
$("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2805 |
}
|
| 2806 |
function drawRewards(){
|
| 2807 |
-
const got=rewardItems(), gold=got.filter(x=>x.gold).length, week=currentWeekDays(), streak=combinedStreak(), summary=$("rewardSummary"), box=$("rewardCollection");
|
| 2808 |
summary.replaceChildren();
|
| 2809 |
-
for(const [n,label] of [[`๐ฅ ${streak.current}`,`ืจืฆืฃ ื ืืืื ยท ืฉืื ${streak.best}`],[
|
| 2810 |
-
const tile=
|
| 2811 |
}
|
| 2812 |
box.replaceChildren();
|
| 2813 |
if(!got.length){ box.append(mark("reward-empty","ืืืจืื ืืจืืฉืื ืืืื ืืื ืืืจื ืฉืชืืืจื ืืฉืคื.","div")); return; }
|
| 2814 |
for(const lesson of LESSONS){
|
| 2815 |
const cats=CATS.filter(c=>c.lesson===lesson.id&&got.some(x=>x.cat.id===c.id)); if(!cats.length) continue;
|
| 2816 |
-
|
|
|
|
|
|
|
| 2817 |
for(const c of cats){
|
| 2818 |
const items=got.filter(x=>x.cat.id===c.id), title=mark("reward-topic",c.name,"h4"), mastered=items.filter(x=>x.gold).length, storyName=c.voices?"ืืฉืืื":"ืืกืืคืืจ";
|
| 2819 |
title.append(mark("",c.story?(items[0].gold?`${storyName} ืืืื`:`${items[0].phrases.filter(p=>best[p.id]>=GOLD).length}/${items[0].phrases.length} ืฉืืจืืช ืืืื`):`${mastered}/${items.length} ืืืื`,"small")); box.append(title);
|
|
@@ -2828,12 +2887,13 @@ function drawRewards(){
|
|
| 2828 |
}
|
| 2829 |
}
|
| 2830 |
}
|
| 2831 |
-
function rewardPop(title,detail,
|
| 2832 |
-
const pop=$("rewardPop"); clearTimeout(rewardTimer); pop.className="reward-pop"+(
|
| 2833 |
pop.querySelector("b").textContent=title; pop.querySelector("small").textContent=detail;
|
| 2834 |
requestAnimationFrame(()=>pop.classList.add("show")); rewardTimer=setTimeout(()=>pop.classList.remove("show"),2600);
|
| 2835 |
}
|
| 2836 |
$("rewardShelf").onclick=()=>{ drawRewards(); $("rewardsDlg").showModal(); };
|
|
|
|
| 2837 |
$("rewardsClose").onclick=()=>$("rewardsDlg").close();
|
| 2838 |
function ball(t,now){ // a topic's button and the disc inside its ring
|
| 2839 |
const b=document.createElement("button"), ring=document.createElement("span"), dot=document.createElement("span");
|
|
@@ -3497,7 +3557,7 @@ let heAudio=null, hePending=null, opened=false; // opened: the sentence the ap
|
|
| 3497 |
async function promptUrl(id){
|
| 3498 |
if(!heUrls[id]){
|
| 3499 |
try{
|
| 3500 |
-
const res=await api(`/api/prompt-audio/${id}?engine=${heEngine}`);
|
| 3501 |
if(!res.ok) return null;
|
| 3502 |
heUrls[id]=URL.createObjectURL(await res.blob());
|
| 3503 |
}catch{ return null; }
|
|
@@ -3892,18 +3952,21 @@ $("heBtn").onclick=async()=>{
|
|
| 3892 |
};
|
| 3893 |
function keepScore(id,s){ // a sentence's best score, on the device and for this visit
|
| 3894 |
const old=best[id], phrase=phraseOf(id), c=phrase&&CATS.find(x=>x.id===phrase.cat), before=c&&topicT(c);
|
|
|
|
| 3895 |
const improved=old==null||s>old;
|
| 3896 |
if(improved){best[id]=s; store.set("ihki.best2",best);}
|
| 3897 |
if(!(sessionBest[id]>=s)) sessionBest[id]=s;
|
| 3898 |
const streakReward=notePracticeDay();
|
| 3899 |
marks();
|
| 3900 |
if(!phrase) return;
|
| 3901 |
-
const after=c&&topicT(c), becameGold=s>=GOLD&&(old==null||old<GOLD);
|
| 3902 |
-
|
| 3903 |
-
|
|
|
|
|
|
|
|
|
|
| 3904 |
else if(streakReward&&streakReward.current>=2) rewardPop(`๐ฅ ืจืฆืฃ ืฉื ${streakReward.current} ืืืื`,streakReward.newBest?"ืฉืื ืืืฉื ืืืฉ":"ืืืฉืืืื ืืืจ");
|
| 3905 |
-
else if(old=
|
| 3906 |
-
else if(improved&&s-old>=8) rewardPop(`ืฉืื ืืืฉ: ${Math.round(old)} โ ${Math.round(s)}`,phrase.he);
|
| 3907 |
}
|
| 3908 |
|
| 3909 |
/* A teacher can inspect the two phoneme sequences already produced by scoring. The expected row uses the
|
|
@@ -3951,7 +4014,7 @@ function drawPhones(r){
|
|
| 3951 |
}
|
| 3952 |
// The classification stage by stage (r.trace, teachers only): the flow with each stage's thresholds and weights,
|
| 3953 |
// then every sound through the stages. Scores are 0..100; probabilities are the model's posteriors in the sound's window.
|
| 3954 |
-
const EXEMPTION_NAMES={glottal_dropped:"ืขืฆืืจื ืกืืชืืืช ืฉืืืฉืืื (ุก / ู)",onset_transient:"ืงืคืืฆื ืืคืจืืื ืืื ืืคื ื ืืขืืฆืืจ ืืจืืฉืื (ืืื 31)",article_vowel_elided:"ืชื ืืขืช ืึพุงู ืืืจื ืชื ืืขื",near_vowel:"ืชื ืืขื ืงืจืืื",unmarked_short_vowel:"ืชื ืืขื ืงืฆืจื ืฉืืื ื ื ืืืงืช (ืืื 30)",final_b_devoicing:"b ืกืืคืืช ืืคื ื ืขืืฆืืจ ืืืื (ืืื 28)",word_final_vowel_linking:"ืชื ืืขื ืกืืคืืช ืืคื ื ืชื ืืขื (ืืื 29)"};
|
| 3955 |
function drawStages(r){
|
| 3956 |
const box=$("stagesBox"), t=r.trace;
|
| 3957 |
if(!t){ box.hidden=true; return; }
|
|
@@ -4334,6 +4397,7 @@ if(!navigator.mediaDevices||!window.MediaRecorder){
|
|
| 4334 |
|
| 4335 |
mic.onclick=()=>{ stopListen(); heStop(); if(quiz&&quiz.over){ quizOff(); drawStory(); } startRec(false); };
|
| 4336 |
async function startRec(auto){ // auto: started by the page for the sentence on screen, not by a press
|
|
|
|
| 4337 |
hePending=null; if(heAudio) heAudio.pause(); // never record the prompt being read out
|
| 4338 |
if(rec&&rec.state==="recording"){ rec.stop(); return; }
|
| 4339 |
if(starting) return;
|
|
@@ -4383,6 +4447,7 @@ async function startRec(auto){ // auto: started by the page for the sentence o
|
|
| 4383 |
render(r); mic.disabled=false; finishRec(r.error?{kind:"nospeech"}:{kind:"result",r});
|
| 4384 |
}catch(err){ $("status").textContent="ืื ืืชืื ื ืืฉื ("+err.message+"). ื ืกื ืฉืื."; mic.disabled=false; finishRec({kind:"fail"}); }
|
| 4385 |
};
|
|
|
|
| 4386 |
rec.start();
|
| 4387 |
}
|
| 4388 |
$("playMine").onclick=()=>{ if(myAudioUrl) new Audio(myAudioUrl).play(); };
|
|
@@ -4673,6 +4738,10 @@ const listenCue=()=>{ mgTone([[880,.14]],"sine",.09); return pause(260); }; //
|
|
| 4673 |
// pass: a grade that moves on. Below it the Arabic answer is heard and the sentence tried once more (`tries` in all).
|
| 4674 |
// quiet: unheard attempts in a row after which the mode stops by itself: the driver is busy, the app should not insist.
|
| 4675 |
const DRIVE={pass:80, great:90, tries:2, quiet:2};
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4676 |
async function drive(){
|
| 4677 |
const run=++driveRun, on=()=>driving&&run===driveRun, st=t=>{ $("status").textContent=t; }, say=t=>sayHe(t,on);
|
| 4678 |
for(const t of Object.values(DRIVE_SAY)) sayUrl(t); // fetched ahead: no wait between the beep and the verdict
|
|
@@ -4704,13 +4773,14 @@ async function drive(){
|
|
| 4704 |
};
|
| 4705 |
while(on()){
|
| 4706 |
const id=cur.id;
|
|
|
|
| 4707 |
if(hear){
|
| 4708 |
st("ืืงืฉืืื ืืืฉืคื");
|
| 4709 |
const url=await promptUrl(id); if(!on()) break;
|
| 4710 |
const played=!!url&&await playUrl(url); if(!on()) break;
|
| 4711 |
-
if(!played){ await speakLocal(speakable(cur.he),"he-IL"); if(!on()) break; } // never skipped in silence
|
| 4712 |
}
|
| 4713 |
-
st("ืชืืจืื");
|
| 4714 |
const out=await recordOnce(); if(!on()) break;
|
| 4715 |
if(out.kind==="nomic"){ await say(DRIVE_SAY.nomic); stopDrive(); break; }
|
| 4716 |
if(out.kind==="cancel") continue;
|
|
@@ -4741,11 +4811,62 @@ async function drive(){
|
|
| 4741 |
await pause(500); await advance();
|
| 4742 |
}
|
| 4743 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4744 |
const DRIVE_ON=$("driveBtn").innerHTML, DRIVE_OFF=DRIVE_ON.replace("i-car","i-stop").replace("ืขืืืจ ืืืฆื ื ืกืืขื","ืกืืื ื ืกืืขื");
|
| 4745 |
$("driveGo").onclick=()=>{ store.set("ihki.driveSeen",true); $("driveDlg").close(); $("driveBtn").onclick(); };
|
| 4746 |
$("driveNo").onclick=()=>$("driveDlg").close();
|
|
|
|
| 4747 |
function stopDrive(){
|
| 4748 |
-
driving=false; driveRun++; document.body.classList.remove("driving"); $("driveBtn").innerHTML=DRIVE_ON; seatMic();
|
|
|
|
| 4749 |
if(driveAudio) driveAudio.pause(); if(driveAudioDone) driveAudioDone();
|
| 4750 |
if("speechSynthesis" in window) speechSynthesis.cancel();
|
| 4751 |
if(rec&&rec.state==="recording"){ recCancel=true; rec.stop(); }
|
|
@@ -4753,18 +4874,24 @@ function stopDrive(){
|
|
| 4753 |
if(wakeLock){ wakeLock.release().catch(()=>{}); wakeLock=null; }
|
| 4754 |
$("status").textContent="ืืืฆื ืืืืจื. ืืืงืืื ื ืขืฆืจืช ืืื ืืฉืืกืืืืื";
|
| 4755 |
}
|
| 4756 |
-
|
| 4757 |
-
if(driving){ stopDrive(); return; }
|
| 4758 |
-
if(!cur||mic.disabled) return;
|
| 4759 |
-
quizOff();
|
| 4760 |
-
if(!store.get("ihki.driveSeen",false)){ $("driveDlg").showModal(); return; } // the first time: what the mode does, and then it starts
|
| 4761 |
primeAudio(); // still inside the tap: the first sentence is heard too
|
| 4762 |
stopListen();
|
| 4763 |
if(rec&&rec.state==="recording"){ recCancel=true; rec.stop(); } // the recording that started by itself
|
| 4764 |
driving=true; document.body.classList.add("driving"); $("driveBtn").innerHTML=DRIVE_OFF; seatMic();
|
| 4765 |
hePending=null; if(heAudio) heAudio.pause();
|
| 4766 |
try{ wakeLock=await navigator.wakeLock.request("screen"); }catch{} // keep the screen on, where supported
|
| 4767 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4768 |
};
|
| 4769 |
|
| 4770 |
/* ---------- the teacher's panel ----------
|
|
@@ -6316,12 +6443,13 @@ function verbTally(q,ok,elapsed){ // the streak, the progress bar, and what is
|
|
| 6316 |
let verbRecorder=null, verbChunks=[], verbRecordingUrl=null;
|
| 6317 |
async function verbRecord(btn,status,actions){
|
| 6318 |
if(verbRecorder?.state==="recording"){verbRecorder.stop();return}
|
|
|
|
| 6319 |
if(!navigator.mediaDevices||!window.MediaRecorder){status.textContent="ืืืคืืคื ืืื ืืื ื ืชืืื ืืืงืืื.";return}
|
| 6320 |
try{
|
| 6321 |
const stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:true,noiseSuppression:true}}), type=pickType(); verbChunks=[];
|
| 6322 |
const rec=verbRecorder=new MediaRecorder(stream,type?{mimeType:type}:{}); rec.ondataavailable=e=>{if(e.data.size)verbChunks.push(e.data)};
|
| 6323 |
rec.onstop=async()=>{stream.getTracks().forEach(t=>t.stop());btn.classList.remove("live");btn.disabled=true;status.textContent="ืืืืงโฆ";const blob=new Blob(verbChunks,{type:rec.mimeType||"audio/webm"}); if(verbRecordingUrl)URL.revokeObjectURL(verbRecordingUrl);verbRecordingUrl=URL.createObjectURL(blob);await scoreVerbSpeech(blob,btn,status,actions)};
|
| 6324 |
-
rec.start();btn.classList.add("live");status.textContent="ืืงืฉืืโฆ ืืืฆื ืฉืื ืืฉืกืืืืชื";
|
| 6325 |
}catch{status.textContent="ืืื ืืืฉื ืืืืงืจืืคืื. ืืฉืจื ืืืฉื ืืืืืจืืช ืืืคืืคื."}
|
| 6326 |
}
|
| 6327 |
async function scoreVerbSpeech(blob,btn,status,actions){
|
|
@@ -6521,6 +6649,7 @@ function drawLabSounds(it){
|
|
| 6521 |
}
|
| 6522 |
$("labMic").onclick=async()=>{
|
| 6523 |
if(labRec&&labRec.state==="recording"){ labRec.stop(); return; }
|
|
|
|
| 6524 |
if(!navigator.mediaDevices||!window.MediaRecorder){ $("labStatus").textContent="ืืืคืืคื ืืื ืืื ื ืชืืื ืืืงืืื."; return; }
|
| 6525 |
let stream;
|
| 6526 |
try{ stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:true,noiseSuppression:true}}); } // as the practice records
|
|
@@ -6547,7 +6676,7 @@ $("labMic").onclick=async()=>{
|
|
| 6547 |
}catch(e){ $("labStatus").textContent=`ืื ืืชืื ื ืืฉื (${e.message}). ื ืกื ืฉืื.`; }
|
| 6548 |
finally{ $("labMic").disabled=false; }
|
| 6549 |
};
|
| 6550 |
-
rec.start(); $("labMic").classList.add("live"); $("labStatus").textContent="ืืงืืืโฆ ืืืฆื ืฉืื ืืกืืื";
|
| 6551 |
};
|
| 6552 |
// Sound by sound: what was expected, what the model heard, the raw posterior and the final score, and whether the
|
| 6553 |
// scorer agreed with the label (a sound said right must not be flagged; the planted mistake must be)
|
|
@@ -6635,6 +6764,7 @@ function wzRow(it){
|
|
| 6635 |
function wzFocus(){ const r=$("wzList").querySelector(".wz-row.cur"); if(r) r.scrollIntoView({block:"center",behavior:"smooth"}); }
|
| 6636 |
async function wzRecord(id){
|
| 6637 |
if(wzRec&&wzRec.state==="recording"){ if(wzRecAt===id) wzRec.stop(); return; }
|
|
|
|
| 6638 |
if(!wzWho()||ttsAt||wzBusy) return;
|
| 6639 |
if(!navigator.mediaDevices||!window.MediaRecorder){ wzStatus("ืืืคืืคื ืืื ืืื ื ืชืืื ืืืงืืื."); return; }
|
| 6640 |
if(wzAudio) wzAudio.pause();
|
|
@@ -6651,7 +6781,7 @@ async function wzRecord(id){
|
|
| 6651 |
wzTakes[id]=new Blob(chunks,{type:rec.mimeType||"audio/webm"}); delete wzHeard[id];
|
| 6652 |
wzStatus("ืืืฉืืขโฆ ืืืจื ืืืฉืืขื: โ ืืืืฉืืจ, โ ืืืืืื."); drawWizard(); wzPlay(id);
|
| 6653 |
};
|
| 6654 |
-
rec.start(); drawWizard();
|
| 6655 |
wzStatus("ืืงืืืโฆ ืืืจื ืืช ืืคืจืื. ืืืงืืื ืชืืขืฆืจ ืืื ืืฉืชืฉืชืชืงื (ืื ืืืฆื โ ).");
|
| 6656 |
vad=startVad(stream,s=>{ spoke=s; if(rec.state==="recording") rec.stop(); },VAD.noSpeech);
|
| 6657 |
setTimeout(()=>rec.state==="recording"&&rec.stop(),VAD.noSpeech+VAD.maxSpeech);
|
|
|
|
| 346 |
@keyframes td-pop{from{transform:scale(0) rotate(-20deg);opacity:0}to{transform:none;opacity:1}}
|
| 347 |
@keyframes td-wobble{0%,70%,100%{transform:none}76%{transform:rotate(-14deg) scale(1.08)}84%{transform:rotate(12deg) scale(1.08)}92%{transform:rotate(-6deg)}}
|
| 348 |
@media (prefers-reduced-motion:reduce){.td-medal,.td-stars span.on,.td-bead,.td-bead.weak{animation:none}}
|
| 349 |
+
.reward-shelf{width:100%;max-width:460px;margin:2px auto 10px;padding:12px 13px;border:2px solid var(--olive);border-radius:18px;background:linear-gradient(135deg,var(--surface),var(--olive-soft));color:var(--ink);display:grid;grid-template-columns:54px minmax(0,1fr);align-items:center;gap:10px;text-align:start;cursor:pointer;box-shadow:0 5px 0 color-mix(in srgb,var(--olive) 32%,var(--line)),0 10px 22px rgb(35 46 31/.12);font-family:var(--f-body);transition:transform .18s,box-shadow .18s}
|
| 350 |
+
.reward-shelf:hover{transform:translateY(-2px);box-shadow:0 7px 0 color-mix(in srgb,var(--olive) 32%,var(--line)),0 13px 26px rgb(35 46 31/.16)}
|
| 351 |
.streak-ring{width:50px;height:50px;border-radius:50%;display:grid;place-items:center;background:var(--amber-bg);border:2px solid var(--orange);color:var(--orange);font:700 16px/1 var(--f-body);box-shadow:0 2px 0 color-mix(in srgb,var(--orange) 55%,var(--line))}
|
| 352 |
+
.reward-copy{display:flex;min-width:0;flex-direction:column;line-height:1.25}.reward-copy b{font-size:17px}.reward-copy small{color:var(--orange);font-weight:700}.reward-totals{grid-column:1/-1;display:grid;grid-template-columns:repeat(3,1fr);gap:7px;width:100%;font:700 13px/1.15 var(--f-body)}.reward-count{display:flex;align-items:center;justify-content:center;gap:5px;min-height:34px;padding:6px;border:1px solid var(--line);border-radius:11px;background:color-mix(in srgb,var(--surface) 88%,transparent);white-space:nowrap}.reward-count::before{content:"";width:17px;height:17px;box-sizing:border-box;border:2px solid #52624b;border-radius:50%;background:radial-gradient(circle at 32% 27%,#dce7d4 0 9%,#769064 23%,#405136 72%);box-shadow:inset -1px -2px 2px rgb(0 0 0/.25)}.reward-count.gold{color:#865b08}.reward-count.gold::before{border-color:#9b690b;background:radial-gradient(circle at 32% 27%,#fff3a7 0 9%,#e4b83e 27%,#9d6509 75%)}.reward-count.misbaha{color:var(--sumac)}.reward-count.misbaha::before{content:"๐ฟ";width:auto;height:auto;border:0;background:none;box-shadow:none;font-size:18px}.reward-week{grid-column:1/-1;color:var(--olive);text-align:center;font-size:12px}
|
| 353 |
body:not(.home) .reward-shelf,body.manage .reward-shelf,body[data-view] .reward-shelf{display:none}
|
| 354 |
+
#rewardsDlg{width:min(94vw,520px);max-height:88vh}.reward-summary{display:grid;grid-template-columns:repeat(5,1fr);gap:8px;margin:4px 0 12px}.reward-summary div{padding:10px 6px;border-radius:12px;background:var(--olive-soft);text-align:center}.reward-summary div:first-child{background:var(--amber-bg);box-shadow:inset 0 0 0 1px var(--orange)}.reward-summary div:first-child b{color:var(--orange)}.reward-summary div.misbaha{background:color-mix(in srgb,var(--sumac-bg) 72%,var(--surface));box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--sumac) 40%,var(--line))}.reward-summary div.misbaha b{color:var(--sumac)}.reward-summary b{display:block;color:var(--olive);font:400 25px/1.1 var(--f-display)}.reward-summary small{font-size:12px;color:var(--muted)}
|
| 355 |
+
.reward-lesson{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:18px 0 0;padding:8px 0 5px;border-bottom:1px solid var(--line);color:var(--olive);font:400 20px/1.2 var(--f-display)}.reward-lesson:first-child{margin-top:8px}.lesson-misbaha{padding:5px 8px;border:1px solid color-mix(in srgb,var(--sumac) 45%,var(--line));border-radius:999px;background:var(--sumac-bg);color:var(--sumac);font:700 12px/1 var(--f-body);white-space:nowrap;animation:td-pop .55s cubic-bezier(.2,1.6,.4,1) both}.reward-topic{margin:10px 0 5px;font:700 15px/1.2 var(--f-body)}.reward-topic small{margin-inline-start:6px;color:var(--muted)}.reward-beads{display:flex;flex-wrap:wrap;gap:7px;direction:rtl}.phrase-bead{width:31px;height:31px;border-radius:50%;border:3px solid #52624b;background:radial-gradient(circle at 32% 27%,#dce7d4 0 9%,#769064 23%,#405136 72%);box-shadow:inset -2px -3px 3px rgb(0 0 0/.3),0 2px 2px rgb(0 0 0/.2);cursor:pointer}.phrase-bead.gold{border-color:#9b690b;background:radial-gradient(circle at 32% 27%,#fff3a7 0 9%,#e4b83e 27%,#9d6509 75%)}
|
| 356 |
.reward-empty{padding:20px;border:1px dashed var(--line);border-radius:12px;color:var(--muted);text-align:center}
|
| 357 |
+
.reward-pop{position:fixed;z-index:60;left:50%;top:18%;width:min(88vw,360px);transform:translate(-50%,-12px) scale(.96);padding:14px 18px;border:1px solid var(--olive);border-radius:16px;background:var(--surface);color:var(--ink);box-shadow:0 12px 38px rgb(0 0 0/.28);text-align:center;opacity:0;pointer-events:none;transition:opacity .18s,transform .18s}.reward-pop.show{opacity:1;transform:translate(-50%,0) scale(1)}.reward-pop b{display:block;color:var(--olive);font:400 22px/1.25 var(--f-display)}.reward-pop.gold b{color:var(--amber)}.reward-pop.misbaha{border-color:var(--sumac);background:linear-gradient(145deg,var(--surface),var(--sumac-bg))}.reward-pop.misbaha b{color:var(--sumac)}.reward-pop small{color:var(--muted);font-weight:600}
|
| 358 |
@media (prefers-reduced-motion:reduce){.reward-pop{transition:none}}
|
| 359 |
+
@media (max-width:430px){.reward-summary{grid-template-columns:repeat(2,1fr)}.reward-summary div.misbaha{grid-column:span 2}}
|
| 360 |
.path{--track:color-mix(in srgb,var(--muted) 75%,var(--bg));position:relative;width:100%;max-width:460px;margin:4px auto 72px;background:#101510 url("/static/assets/arabic-calligraphy-path.webp?v=7") top center/100% auto repeat-y}
|
| 361 |
.road{position:absolute;left:50%;top:0;width:1px;height:100%;overflow:visible;pointer-events:none}
|
| 362 |
.road path{fill:none;stroke-linecap:round}
|
|
|
|
| 483 |
}
|
| 484 |
@media (max-width:360px){.eitan-chips{grid-template-columns:repeat(2,minmax(0,1fr))}.eitan-legend span{font-size:10px}.eitan-body{font-size:24px}}
|
| 485 |
.card{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:14px 16px;display:flex;flex-direction:column;gap:10px}
|
| 486 |
+
.exercise-collector{align-self:flex-end;display:flex;align-items:center;gap:8px;margin:-4px -5px 0 0;padding:6px 9px;border:1px solid var(--line);border-radius:999px;background:linear-gradient(135deg,var(--olive-soft),var(--surface));color:var(--olive);box-shadow:0 2px 0 var(--line);font:700 12px/1.15 var(--f-body);cursor:pointer}.exercise-collector small{display:block;color:var(--muted);font-weight:600}.collector-beads{position:relative;display:flex;align-items:center;padding:0 5px}.collector-beads::before{content:"";position:absolute;left:0;right:0;height:2px;background:#8b6c3e}.collector-beads i{position:relative;width:14px;height:14px;margin-inline-start:-2px;border:2px solid #52624b;border-radius:50%;background:radial-gradient(circle at 32% 27%,#dce7d4 0 9%,#769064 23%,#405136 72%);box-shadow:inset -1px -2px 2px rgb(0 0 0/.25)}.collector-beads i:last-child{border-color:#9b690b;background:radial-gradient(circle at 32% 27%,#fff3a7 0 9%,#e4b83e 27%,#9d6509 75%)}.exercise-collector.catch{animation:collector-catch .55s cubic-bezier(.2,1.7,.4,1)}
|
| 487 |
+
.flying-reward-bead{position:fixed;z-index:100;width:28px;height:28px;box-sizing:border-box;border:3px solid #52624b;border-radius:50%;background:radial-gradient(circle at 32% 27%,#dce7d4 0 9%,#769064 23%,#405136 72%);box-shadow:inset -2px -3px 3px rgb(0 0 0/.3),0 5px 10px rgb(0 0 0/.28);pointer-events:none;animation:reward-bead-flight .85s cubic-bezier(.2,.75,.25,1) forwards}.flying-reward-bead.gold{border-color:#9b690b;background:radial-gradient(circle at 32% 27%,#fff3a7 0 9%,#e4b83e 27%,#9d6509 75%)}
|
| 488 |
+
@keyframes reward-bead-flight{0%{transform:translate(0,0) scale(.65) rotate(0);opacity:0}15%{opacity:1;transform:translate(0,-22px) scale(1.18) rotate(80deg)}65%{opacity:1;transform:translate(var(--fly-mid-x),var(--fly-mid-y)) scale(1) rotate(300deg)}100%{transform:translate(var(--fly-x),var(--fly-y)) scale(.35) rotate(540deg);opacity:.15}}
|
| 489 |
+
@keyframes collector-catch{0%,100%{transform:none}45%{transform:scale(1.12) rotate(-2deg)}}
|
| 490 |
.meta{display:flex;justify-content:space-between;color:var(--muted);font-size:13px;letter-spacing:.04em;font-variant-numeric:tabular-nums}
|
| 491 |
.meta .idx{background:var(--olive-soft);color:var(--olive);font-weight:700;padding:1px 10px;border-radius:999px}
|
| 492 |
.progress{height:4px;border-radius:999px;background:var(--line);overflow:hidden;margin-top:-4px}
|
|
|
|
| 540 |
.mic.live::after{content:"";position:absolute;inset:-6px;border-radius:50%;border:3px solid var(--sumac);opacity:.5;animation:pulse 1.2s ease-out infinite}
|
| 541 |
.mic:disabled{opacity:.5;cursor:progress}
|
| 542 |
@keyframes pulse{from{transform:scale(.9);opacity:.6}to{transform:scale(1.15);opacity:0}}
|
| 543 |
+
@media (prefers-reduced-motion:reduce){.mic.live::after,.flying-reward-bead,.exercise-collector.catch{animation:none}}
|
| 544 |
.status{font-size:14px}
|
| 545 |
/* A phrase to read has two microphones side by side: the Arabic one (filled; the reading is scored) and the Hebrew one
|
| 546 |
(outlined; the translation is checked). Each carries its language's letter and a line under it saying what it does. */
|
|
|
|
| 1026 |
/* driving mode: nothing to read or press but the stop button */
|
| 1027 |
body.driving .roundbar,body.driving .row,body.driving .voicebox,body.driving .task{display:none}
|
| 1028 |
body.driving .prompt{font-size:clamp(30px,8vw,48px)}
|
| 1029 |
+
body.driving .prompt .drive-he{display:block;font:600 clamp(22px,5.5vw,32px)/1.35 var(--f-body);color:var(--muted)}
|
| 1030 |
+
body.driving .prompt .drive-tr{display:block;margin-top:10px;font:400 clamp(30px,8vw,48px)/1.35 var(--f-tr);color:var(--ink);letter-spacing:.025em}
|
| 1031 |
body.driving .status{font-size:20px;font-weight:700;color:var(--ink)}
|
| 1032 |
body.driving .mic{width:84px;height:84px}
|
| 1033 |
+
#storyDriveToggle{display:none}body.driving.story-driving #mic{display:none}body.driving.story-driving #storyDriveToggle{display:grid;width:96px;height:96px;background:var(--olive);color:var(--on-olive);box-shadow:0 5px 0 var(--olive-deep)}body.driving.story-driving #storyDriveToggle svg{width:38px;height:38px}
|
| 1034 |
.voicebox{display:flex;flex-direction:column;font-size:16px}
|
| 1035 |
.voicebox label{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:48px;border-bottom:1px solid var(--line);cursor:pointer}
|
| 1036 |
.voicebox label:last-child{border-bottom:0}
|
| 1037 |
.voicebox input,.donebox input{width:20px;height:20px;accent-color:var(--olive)}
|
| 1038 |
+
#setDlg,#driveDlg,#storyDriveDlg{width:min(92vw,380px)}
|
| 1039 |
+
#storyDriveDlg .lacts .btn{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px}#storyDriveDlg .lacts small{display:block;color:inherit;font-size:12px;font-weight:500;opacity:.78}
|
| 1040 |
.dlg-text{margin:4px 0 14px;font-size:16px}
|
| 1041 |
.voicebox select{font:600 14px var(--f-body);padding:4px 8px;border-radius:8px;border:1px solid var(--line);background:var(--surface);color:var(--ink)}
|
| 1042 |
.warn{background:var(--amber-bg);color:var(--amber);border-radius:10px;padding:10px 12px;font-size:14px}
|
|
|
|
| 1420 |
<button class="reward-shelf" id="rewardShelf" type="button" hidden>
|
| 1421 |
<span class="streak-ring" id="rewardStreak">๐ฅ 0</span>
|
| 1422 |
<span class="reward-copy"><b>ืืขืจืืืช ืฉืืืจ ืฉืืื</b><small id="rewardCopy">ืขืื ืื ื ืืกืคื ืืฉืคืืื</small></span>
|
| 1423 |
+
<span class="reward-totals">
|
| 1424 |
+
<span class="reward-count" id="rewardRegular">0 ืจืืืืื</span>
|
| 1425 |
+
<span class="reward-count gold" id="rewardGold">0 ืืื</span>
|
| 1426 |
+
<span class="reward-count misbaha" id="rewardMisbaha">0 ืืกืืืืช</span>
|
| 1427 |
+
<span class="reward-week" id="rewardWeek">0/4 ืืื ืชืจืืื ืืฉืืืข</span>
|
| 1428 |
+
</span>
|
| 1429 |
</button>
|
| 1430 |
<section id="vids" aria-live="polite"></section>
|
| 1431 |
<nav id="nav" aria-label="ื ืืืื"><button data-view="">ืืกืืื</button><button data-view="live">ืฉืืขืืจ ืื</button><button data-view="verbs">ืคืขืืื</button><button data-view="games" hidden>ืืฉืืงืื</button><button data-view="refer">ืืืจ ืืืื ืืืจ</button></nav>
|
|
|
|
| 1448 |
<div id="envWarn" class="warn" hidden></div>
|
| 1449 |
|
| 1450 |
<main class="card" id="card" aria-live="polite">
|
| 1451 |
+
<button class="exercise-collector" id="exerciseCollector" type="button" aria-label="ืคืชืืืช ืืืกืฃ ืืืจืืืื">
|
| 1452 |
+
<span class="collector-beads" id="collectorTarget" aria-hidden="true"><i></i><i></i><i></i></span>
|
| 1453 |
+
<span>ืืืกืฃ ืืืจืืืื ืฉืื<small id="exerciseCollectorCount">0 ืืจืืืื</small></span>
|
| 1454 |
+
</button>
|
| 1455 |
<div class="bubble-score" id="bubbleScore" hidden><span>ื ืืงืื<small id="bubbleCount"></small></span><b id="bubblePoints">0</b></div>
|
| 1456 |
<div class="bubble-best" id="bubbleBest" hidden><span>๐ ืฉืื</span><b id="bubbleBestPoints">โ</b></div>
|
| 1457 |
<button class="bubble-help" id="bubbleHelp" type="button" aria-label="ืื ืืืืช ืืืฉืืง" title="ืื ืืืืช ืืืฉืืง" hidden>?</button>
|
|
|
|
| 1469 |
<button class="mic" id="mic" data-lang="ุน" aria-label="ืืงืืืื ืืช ืืชืฉืืื">
|
| 1470 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="2" width="6" height="12" rx="3" fill="currentColor"/><path d="M5 11a7 7 0 0 0 14 0M12 18v4M8 22h8"/></svg>
|
| 1471 |
</button>
|
| 1472 |
+
<button class="mic" id="storyDriveToggle" type="button" aria-label="ืืฉืืืืช ืืฉืืื">
|
| 1473 |
+
<svg class="ic" aria-hidden="true"><use href="#i-pause"/></svg>
|
| 1474 |
+
</button>
|
| 1475 |
<button class="btn phone-btn" id="phoneBtn" title="ืืฉืืืืช ืจืฆืฃ ืืคืื ืืืช ืืฆืคืื ืืื ืฉืืืืื ืฉืืข" aria-label="ื ืืชืื ืคืื ืืืช" hidden disabled>/fษ/</button>
|
| 1476 |
<div class="status" id="status">ืืืฆื ืืืืจื. ืืืงืืื ื ืขืฆืจืช ืืื ืืฉืืกืืืืื</div>
|
| 1477 |
<button class="btn" id="quietBtn" title="ืชืจืืื ืืื ืืืงืจืืคืื: ืืจืืืืื ืืช ืืืฉืคื ืืขืจืืืช ืืืืืื. ืื ื ืจืฉื ืฆืืื">ืชืจืืื ืฉืงื ืืื ืฆืืื</button>
|
|
|
|
| 1732 |
</dialog>
|
| 1733 |
<dialog id="rewardsDlg" aria-labelledby="rewardsTitle">
|
| 1734 |
<div class="dlg-head"><h2 id="rewardsTitle">ืืขืจืืืช ืฉืืืจ ืฉืืื</h2><button class="btn" id="rewardsClose">ืกืืืจื</button></div>
|
| 1735 |
+
<p class="dlg-text">ืื ืชืจืืื ืฉืืฉืืืชื ืืขื ืืง ืืจืื, ืืฆืืื 75 ืืืขืื ืืืคื ืืืชื ืืืื. ืืฉืืืชื ืฉืืขืืจ ืฉืื? ืืจืืืืชื ืืกืืื! ืกืืคืืจ ืื ืฉืืื ืฉืืืื ืื ืืจืื ืืื, ืฉืืืืื ืืฉืื ืฉืืจืืชืื ืืืื.</p>
|
| 1736 |
<div class="reward-summary" id="rewardSummary"></div>
|
| 1737 |
<div id="rewardCollection"></div>
|
| 1738 |
</dialog>
|
|
|
|
| 1742 |
<p class="dlg-text">ืชืจืืื ืืื ืืืขืช ืืืกื: ืืืคืืืงืฆืื ืืงืจืืื ืื ืืฉืคื, ืืฆืคืฆืคืช ืืฉืชืืจืื ืืืืจ, ืืืืืจืช ืืงืื ืื ืืฆืืืชื. ืืฉืื ืืฆืืืชื ืฉืืืขืื ืืช ืืชืฉืืื ืืื ืกืื ืคืขื ืืืช ื ืืกืคืช. ืืกืืฃ ืื ืืฉื ืฉืืืืช ืื ืืขืืืจ ืื ืืฉื ืืื. ืื ืื ืขืื ืื ืคืขืืืื ืืจืฆืฃ, ืืืฆื ื ืขืฆืจ ืืื. ืืกืืื ืืืืฆืื ืขื "ืกืืื ื ืกืืขื".</p>
|
| 1743 |
<div class="row"><button class="btn primary" id="driveGo">ืืชืืืื</button><button class="btn" id="driveNo">ืื ืขืืฉืื</button></div>
|
| 1744 |
</dialog>
|
| 1745 |
+
<dialog id="storyDriveDlg" aria-labelledby="storyDriveTitle">
|
| 1746 |
+
<div class="dlg-head"><h2 id="storyDriveTitle">ืืื ืืืงืฉืื ืืฉืืื?</h2><button class="btn" id="storyDriveNo" aria-label="ืกืืืจื">โ</button></div>
|
| 1747 |
+
<p class="dlg-text">ืืืจื ืื ืืฉืืืข ืืืฆื ื ืกืืขื:</p>
|
| 1748 |
+
<div class="lacts">
|
| 1749 |
+
<button class="btn primary" id="storyDriveArabic">ืขืจืืืช ืืืื<small>ืื ืืฉืืื, ืขื 3 ืฉื ืืืช ืืื ืืืฉืคืืื</small></button>
|
| 1750 |
+
<button class="btn" id="storyDriveBoth">ืขืืจืืช ืืื ืขืจืืืช<small>ืืชืจืืื ืืืืจืื ืืืฉืคื ืืขืจืืืช</small></button>
|
| 1751 |
+
</div>
|
| 1752 |
+
</dialog>
|
| 1753 |
<dialog id="bubbleGuideDlg" aria-labelledby="bubbleGuideTitle">
|
| 1754 |
<div class="dlg-head"><h2 id="bubbleGuideTitle">ืืื ืืฉืืงืื ืืคืืขื ืืื ื?</h2><button class="btn" id="bubbleGuideClose">ืกืืืจื</button></div>
|
| 1755 |
<p class="dlg-text">ืืื ืกืืืื ืืืคืืข ืคืืขื ืืขืืจืืช ืืชืื ืืจืื. ืืืจื ืืืชื ืืขืจืืืช ืืืืืจืช โ ืืขืืจ ืืื ืืขืชืื โ ืืคื ื ืฉืืืขืช ืืืื ื ืขืืืช.</p>
|
|
|
|
| 2743 |
}
|
| 2744 |
async function liveRecord(){
|
| 2745 |
if(LIVE.rec&&LIVE.rec.state==="recording"){ LIVE.rec.stop(); return; }
|
| 2746 |
+
unlockPlayback(); // keep the recording cue available after awaiting microphone permission
|
| 2747 |
let stream; try{ stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:true,noiseSuppression:true}}); }catch{ $("liveStatus").textContent="ืืื ืืืฉื ืืืืงืจืืคืื"; return; }
|
| 2748 |
const chunks=[], type=pickType(); LIVE.rec=new MediaRecorder(stream,type?{mimeType:type}:{}); LIVE.busy=true;
|
| 2749 |
LIVE.rec.ondataavailable=e=>{if(e.data.size)chunks.push(e.data)}; LIVE.rec.onstart=()=>{ $("liveMic").classList.add("recording"); $("liveStatus").textContent="ืืงืืืโฆ ืืืฆื ืืกืืื"; };
|
| 2750 |
LIVE.rec.onstop=async()=>{ stream.getTracks().forEach(t=>t.stop()); const blob=new Blob(chunks,{type:LIVE.rec.mimeType||"audio/webm"}), fd=new FormData(); fd.append("audio",blob,"live"); $("liveStatus").textContent="ืืืืงืืโฆ";
|
| 2751 |
try{ const res=await api(`/api/live/${LIVE.code}/answer`,{method:"POST",body:fd}), data=await res.json().catch(()=>({})); if(!res.ok) throw new Error(data.detail||res.status); }catch(err){ $("liveStatus").textContent=`ืื ืืฆืืื ื ืืืืืง: ${err.message}`; }
|
| 2752 |
LIVE.busy=false; LIVE.rec=null; loadLiveSession(); };
|
| 2753 |
+
await listenCue();
|
| 2754 |
LIVE.rec.start(); setTimeout(()=>LIVE.rec&&LIVE.rec.state==="recording"&&LIVE.rec.stop(),10000);
|
| 2755 |
}
|
| 2756 |
const referTab=$("nav").querySelector('[data-view="refer"]'), referSeenKey="ihki.referSeen.2027";
|
|
|
|
| 2825 |
}
|
| 2826 |
return items;
|
| 2827 |
}
|
| 2828 |
+
function lessonRewards(){
|
| 2829 |
+
return LESSONS.filter(l=>!l.soon&&tally(lessonList(l)).over);
|
| 2830 |
+
}
|
| 2831 |
+
function drawExerciseCollector(){
|
| 2832 |
+
const got=rewardItems(), gold=got.filter(x=>x.gold).length;
|
| 2833 |
+
$("exerciseCollectorCount").textContent=`${got.length} ืืจืืืื ยท ${gold} ืืื`;
|
| 2834 |
+
$("exerciseCollector").setAttribute("aria-label",`ืคืชืืืช ืืืืกืฃ: ${got.length} ืืจืืืื, ืืื ${gold} ืืื`);
|
| 2835 |
+
}
|
| 2836 |
+
function flyRewardBead(gold){
|
| 2837 |
+
const source=$("mic"), target=$("collectorTarget"), collector=$("exerciseCollector");
|
| 2838 |
+
if(!source||!target||collector.offsetParent===null) return;
|
| 2839 |
+
const from=source.getBoundingClientRect(), to=target.getBoundingClientRect();
|
| 2840 |
+
if(!from.width||!to.width) return;
|
| 2841 |
+
const bead=mark(`flying-reward-bead${gold?" gold":""}`,"","i"), x=from.left+from.width/2-14, y=from.top+from.height/2-14;
|
| 2842 |
+
const dx=to.left+to.width/2-14-x, dy=to.top+to.height/2-14-y;
|
| 2843 |
+
bead.style.left=`${x}px`; bead.style.top=`${y}px`;
|
| 2844 |
+
bead.style.setProperty("--fly-x",`${dx}px`); bead.style.setProperty("--fly-y",`${dy}px`);
|
| 2845 |
+
bead.style.setProperty("--fly-mid-x",`${dx*.72}px`); bead.style.setProperty("--fly-mid-y",`${dy*.78-34}px`);
|
| 2846 |
+
document.body.append(bead);
|
| 2847 |
+
const land=()=>{ bead.remove(); collector.classList.remove("catch"); void collector.offsetWidth; collector.classList.add("catch"); setTimeout(()=>collector.classList.remove("catch"),600); };
|
| 2848 |
+
if(matchMedia("(prefers-reduced-motion: reduce)").matches) land(); else{ bead.addEventListener("animationend",land,{once:true}); setTimeout(()=>bead.isConnected&&land(),1100); }
|
| 2849 |
+
}
|
| 2850 |
function drawRewardShelf(){
|
| 2851 |
const shelf=$("rewardShelf"); if(!PHRASES.length){ shelf.hidden=true; return; }
|
| 2852 |
+
const got=rewardItems(), gold=got.filter(x=>x.gold).length, regular=got.length-gold, misbahas=lessonRewards().length, wd=currentWeekDays(), streak=combinedStreak(), goal=4;
|
| 2853 |
$("rewardStreak").textContent=`๐ฅ ${streak.current}`; $("rewardStreak").title=`ืจืฆืฃ ื ืืืื: ${streak.current} ืืืื ยท ืฉืื ืืืฉื: ${streak.best}`;
|
| 2854 |
+
$("rewardCopy").textContent=misbahas?`${misbahas} ${misbahas===1?"ืืกืืื ื ืืกืคื":"ืืกืืืืช ื ืืกืคื"} ยท ืืืฉืืืื ืืฉืืขืืจ ืืื!`:streak.current?`ืจืฆืฃ ืฉื ${streak.current} ืืืื ยท ืฉืื ${streak.best}`:got.length?`${got.length} ืืจืืืื ืืืจ ื ืืกืคื`:`ืืืจื ืืฉืคื ืจืืฉืื ืืืชืืืื ืืืกืืฃ`;
|
| 2855 |
$("rewardWeek").textContent=`${Math.min(wd,goal)}/${goal} ืืฉืืืข`;
|
| 2856 |
+
$("rewardRegular").textContent=`${regular} ืจืืืืื`;
|
| 2857 |
+
$("rewardGold").textContent=`${gold} ืืื`;
|
| 2858 |
+
$("rewardMisbaha").textContent=`${misbahas} ืืกืืืืช`;
|
| 2859 |
+
shelf.setAttribute("aria-label",`ืืืกืฃ ืืคืจืกืื: ${regular} ืืจืืืื ืจืืืืื, ${gold} ืืจืืื ืืื, ${misbahas} ืืกืืืืช`);
|
| 2860 |
+
drawExerciseCollector();
|
| 2861 |
+
shelf.hidden=false;
|
| 2862 |
}
|
| 2863 |
function drawRewards(){
|
| 2864 |
+
const got=rewardItems(), gold=got.filter(x=>x.gold).length, regular=got.length-gold, earned=new Set(lessonRewards().map(l=>l.id)), week=currentWeekDays(), streak=combinedStreak(), summary=$("rewardSummary"), box=$("rewardCollection");
|
| 2865 |
summary.replaceChildren();
|
| 2866 |
+
for(const [n,label,cls] of [[`๐ฅ ${streak.current}`,`ืจืฆืฃ ื ืืืื ยท ืฉืื ${streak.best}`,""],[regular,"ืืจืืืื ืจืืืืื",""] ,[gold,"ืืจืืื ืืื",""] ,[earned.size,"ืืกืืืืช ืืฉืืขืืจืื","misbaha"],[week,"ืืื ืชืจืืื ืืฉืืืข",""]]){
|
| 2867 |
+
const tile=mark(cls,"","div"); tile.append(mark("",String(n),"b"),mark("",label,"small")); summary.append(tile);
|
| 2868 |
}
|
| 2869 |
box.replaceChildren();
|
| 2870 |
if(!got.length){ box.append(mark("reward-empty","ืืืจืื ืืจืืฉืื ืืืื ืืื ืืืจื ืฉืชืืืจื ืืฉืคื.","div")); return; }
|
| 2871 |
for(const lesson of LESSONS){
|
| 2872 |
const cats=CATS.filter(c=>c.lesson===lesson.id&&got.some(x=>x.cat.id===c.id)); if(!cats.length) continue;
|
| 2873 |
+
const lessonTitle=mark("reward-lesson",lessonName(lesson),"h3");
|
| 2874 |
+
if(earned.has(lesson.id)) lessonTitle.append(mark("lesson-misbaha","๐ฟ ืืกืืื ื ืืกืคื","span"));
|
| 2875 |
+
box.append(lessonTitle);
|
| 2876 |
for(const c of cats){
|
| 2877 |
const items=got.filter(x=>x.cat.id===c.id), title=mark("reward-topic",c.name,"h4"), mastered=items.filter(x=>x.gold).length, storyName=c.voices?"ืืฉืืื":"ืืกืืคืืจ";
|
| 2878 |
title.append(mark("",c.story?(items[0].gold?`${storyName} ืืืื`:`${items[0].phrases.filter(p=>best[p.id]>=GOLD).length}/${items[0].phrases.length} ืฉืืจืืช ืืืื`):`${mastered}/${items.length} ืืืื`,"small")); box.append(title);
|
|
|
|
| 2887 |
}
|
| 2888 |
}
|
| 2889 |
}
|
| 2890 |
+
function rewardPop(title,detail,kind=false){
|
| 2891 |
+
const pop=$("rewardPop"); clearTimeout(rewardTimer); pop.className="reward-pop"+(kind===true?" gold":kind?` ${kind}`:"");
|
| 2892 |
pop.querySelector("b").textContent=title; pop.querySelector("small").textContent=detail;
|
| 2893 |
requestAnimationFrame(()=>pop.classList.add("show")); rewardTimer=setTimeout(()=>pop.classList.remove("show"),2600);
|
| 2894 |
}
|
| 2895 |
$("rewardShelf").onclick=()=>{ drawRewards(); $("rewardsDlg").showModal(); };
|
| 2896 |
+
$("exerciseCollector").onclick=()=>{ drawRewards(); $("rewardsDlg").showModal(); };
|
| 2897 |
$("rewardsClose").onclick=()=>$("rewardsDlg").close();
|
| 2898 |
function ball(t,now){ // a topic's button and the disc inside its ring
|
| 2899 |
const b=document.createElement("button"), ring=document.createElement("span"), dot=document.createElement("span");
|
|
|
|
| 3557 |
async function promptUrl(id){
|
| 3558 |
if(!heUrls[id]){
|
| 3559 |
try{
|
| 3560 |
+
const res=await api(`/api/prompt-audio/${id}?engine=${heEngine}&v=2`);
|
| 3561 |
if(!res.ok) return null;
|
| 3562 |
heUrls[id]=URL.createObjectURL(await res.blob());
|
| 3563 |
}catch{ return null; }
|
|
|
|
| 3952 |
};
|
| 3953 |
function keepScore(id,s){ // a sentence's best score, on the device and for this visit
|
| 3954 |
const old=best[id], phrase=phraseOf(id), c=phrase&&CATS.find(x=>x.id===phrase.cat), before=c&&topicT(c);
|
| 3955 |
+
const lesson=c&&LESSONS.find(l=>l.id===c.lesson), lessonBefore=lesson&&tally(lessonList(lesson));
|
| 3956 |
const improved=old==null||s>old;
|
| 3957 |
if(improved){best[id]=s; store.set("ihki.best2",best);}
|
| 3958 |
if(!(sessionBest[id]>=s)) sessionBest[id]=s;
|
| 3959 |
const streakReward=notePracticeDay();
|
| 3960 |
marks();
|
| 3961 |
if(!phrase) return;
|
| 3962 |
+
const after=c&&topicT(c), lessonAfter=lesson&&tally(lessonList(lesson)), becameGold=s>=GOLD&&(old==null||old<GOLD);
|
| 3963 |
+
const newBead=old==null&&(!c?.story||before.done===0);
|
| 3964 |
+
if(newBead) flyRewardBead(s>=GOLD);
|
| 3965 |
+
if(improved&&lessonBefore&&!lessonBefore.over&&lessonAfter.over) rewardPop("๐ฟ ืืกืืื ืืืฉื!",`${lessonName(lesson)} ืืืฉืื`,"misbaha");
|
| 3966 |
+
else if(improved&&before&&!before.over&&after.over) rewardPop(after.gold?"ืื ืืฉื ืืืื ืืืื!":"ืื ืืฉื ืืืฉืื!",c.name,after.gold);
|
| 3967 |
+
else if(becameGold&&old!=null&&!c?.story) rewardPop("ืืืฉืคื ืืคื ืืืื โ
",phrase.he,true);
|
| 3968 |
else if(streakReward&&streakReward.current>=2) rewardPop(`๐ฅ ืจืฆืฃ ืฉื ${streakReward.current} ืืืื`,streakReward.newBest?"ืฉืื ืืืฉื ืืืฉ":"ืืืฉืืืื ืืืจ");
|
| 3969 |
+
else if(improved&&old!=null&&s-old>=8) rewardPop(`ืฉืื ืืืฉ: ${Math.round(old)} โ ${Math.round(s)}`,phrase.he);
|
|
|
|
| 3970 |
}
|
| 3971 |
|
| 3972 |
/* A teacher can inspect the two phoneme sequences already produced by scoring. The expected row uses the
|
|
|
|
| 4014 |
}
|
| 4015 |
// The classification stage by stage (r.trace, teachers only): the flow with each stage's thresholds and weights,
|
| 4016 |
// then every sound through the stages. Scores are 0..100; probabilities are the model's posteriors in the sound's window.
|
| 4017 |
+
const EXEMPTION_NAMES={glottal_dropped:"ืขืฆืืจื ืกืืชืืืช ืฉืืืฉืืื (ุก / ู)",onset_transient:"ืงืคืืฆื ืืคืจืืื ืืื ืืคื ื ืืขืืฆืืจ ืืจืืฉืื (ืืื 31)",article_vowel_elided:"ืชื ืืขืช ืึพุงู ืืืจื ืชื ืืขื",near_vowel:"ืชื ืืขื ืงืจืืื",unmarked_short_vowel:"ืชื ืืขื ืงืฆืจื ืฉืืื ื ื ืืืงืช (ืืื 30)",final_b_devoicing:"b ืกืืคืืช ืืคื ื ืขืืฆืืจ ืืืื (ืืื 28)",t_d_voicing:"t ืึพd ืื ืืชืืืคืืช (ืืื 32)",word_final_vowel_linking:"ืชื ืืขื ืกืืคืืช ืืคื ื ืชื ืืขื (ืืื 29)"};
|
| 4018 |
function drawStages(r){
|
| 4019 |
const box=$("stagesBox"), t=r.trace;
|
| 4020 |
if(!t){ box.hidden=true; return; }
|
|
|
|
| 4397 |
|
| 4398 |
mic.onclick=()=>{ stopListen(); heStop(); if(quiz&&quiz.over){ quizOff(); drawStory(); } startRec(false); };
|
| 4399 |
async function startRec(auto){ // auto: started by the page for the sentence on screen, not by a press
|
| 4400 |
+
unlockPlayback(); // a manual tap unlocks the cue before getUserMedia's asynchronous permission flow
|
| 4401 |
hePending=null; if(heAudio) heAudio.pause(); // never record the prompt being read out
|
| 4402 |
if(rec&&rec.state==="recording"){ rec.stop(); return; }
|
| 4403 |
if(starting) return;
|
|
|
|
| 4447 |
render(r); mic.disabled=false; finishRec(r.error?{kind:"nospeech"}:{kind:"result",r});
|
| 4448 |
}catch(err){ $("status").textContent="ืื ืืชืื ื ืืฉื ("+err.message+"). ื ืกื ืฉืื."; mic.disabled=false; finishRec({kind:"fail"}); }
|
| 4449 |
};
|
| 4450 |
+
await listenCue();
|
| 4451 |
rec.start();
|
| 4452 |
}
|
| 4453 |
$("playMine").onclick=()=>{ if(myAudioUrl) new Audio(myAudioUrl).play(); };
|
|
|
|
| 4738 |
// pass: a grade that moves on. Below it the Arabic answer is heard and the sentence tried once more (`tries` in all).
|
| 4739 |
// quiet: unheard attempts in a row after which the mode stops by itself: the driver is busy, the app should not insist.
|
| 4740 |
const DRIVE={pass:80, great:90, tries:2, quiet:2};
|
| 4741 |
+
function drawDrivePhrase(id){
|
| 4742 |
+
const p=phraseOf(id), prompt=$("prompt"), he=mark("drive-he",p.he,"span"), tr=mark("drive-tr","","span");
|
| 4743 |
+
setTr(tr,p.tr); prompt.replaceChildren(he,tr);
|
| 4744 |
+
}
|
| 4745 |
async function drive(){
|
| 4746 |
const run=++driveRun, on=()=>driving&&run===driveRun, st=t=>{ $("status").textContent=t; }, say=t=>sayHe(t,on);
|
| 4747 |
for(const t of Object.values(DRIVE_SAY)) sayUrl(t); // fetched ahead: no wait between the beep and the verdict
|
|
|
|
| 4773 |
};
|
| 4774 |
while(on()){
|
| 4775 |
const id=cur.id;
|
| 4776 |
+
drawDrivePhrase(id);
|
| 4777 |
if(hear){
|
| 4778 |
st("ืืงืฉืืื ืืืฉืคื");
|
| 4779 |
const url=await promptUrl(id); if(!on()) break;
|
| 4780 |
const played=!!url&&await playUrl(url); if(!on()) break;
|
| 4781 |
+
if(!played){ await speakLocal(speakable(cur.he_say||cur.he),"he-IL"); if(!on()) break; } // never skipped in silence
|
| 4782 |
}
|
| 4783 |
+
st("ืชืืจืื");
|
| 4784 |
const out=await recordOnce(); if(!on()) break;
|
| 4785 |
if(out.kind==="nomic"){ await say(DRIVE_SAY.nomic); stopDrive(); break; }
|
| 4786 |
if(out.kind==="cancel") continue;
|
|
|
|
| 4811 |
await pause(500); await advance();
|
| 4812 |
}
|
| 4813 |
}
|
| 4814 |
+
let storyDrivePaused=false, storyDriveWake=null;
|
| 4815 |
+
const storyDriveGate=()=>storyDrivePaused?new Promise(resolve=>storyDriveWake=resolve):Promise.resolve();
|
| 4816 |
+
function storyDriveFace(){
|
| 4817 |
+
const button=$("storyDriveToggle"), use=button.querySelector("use");
|
| 4818 |
+
use.setAttribute("href",storyDrivePaused?"#i-play":"#i-pause");
|
| 4819 |
+
button.setAttribute("aria-label",storyDrivePaused?"๏ฟฝ๏ฟฝืืฉื ืืฉืืื":"ืืฉืืืืช ืืฉืืื");
|
| 4820 |
+
}
|
| 4821 |
+
$("storyDriveToggle").onclick=()=>{
|
| 4822 |
+
storyDrivePaused=!storyDrivePaused; storyDriveFace();
|
| 4823 |
+
if(storyDrivePaused){
|
| 4824 |
+
if(driveAudio&&!driveAudio.paused&&!driveAudio.ended) driveAudio.pause();
|
| 4825 |
+
if("speechSynthesis" in window) speechSynthesis.pause();
|
| 4826 |
+
$("status").textContent="ืืืฉืืขื ืืืฉืืืช";
|
| 4827 |
+
}else{
|
| 4828 |
+
if(driveAudio&&driveAudio.paused&&!driveAudio.ended) driveAudio.play().catch(()=>{ if(driveAudioDone) driveAudioDone(); });
|
| 4829 |
+
if("speechSynthesis" in window) speechSynthesis.resume();
|
| 4830 |
+
if(storyDriveWake){ const wake=storyDriveWake; storyDriveWake=null; wake(); }
|
| 4831 |
+
$("status").textContent="ืืืฉืืืื ืืฉืืื";
|
| 4832 |
+
}
|
| 4833 |
+
};
|
| 4834 |
+
async function driveStory(mode){
|
| 4835 |
+
const run=++driveRun, on=()=>driving&&run===driveRun;
|
| 4836 |
+
document.body.classList.add("story-driving"); storyDrivePaused=false; storyDriveFace();
|
| 4837 |
+
const arabic=async id=>{ const a=await answerAudio(id); if(!on()) return; await storyDriveGate(); if(!on()) return; if(a) await playUrl(a.url,true); else await speakLocal(phraseOf(id).ar,"ar"); };
|
| 4838 |
+
const hebrew=async id=>{
|
| 4839 |
+
const url=await promptUrl(id); if(!on()) return;
|
| 4840 |
+
await storyDriveGate(); if(!on()) return;
|
| 4841 |
+
const played=!!url&&await playUrl(url); if(!on()) return;
|
| 4842 |
+
const p=phraseOf(id); if(!played) await speakLocal(speakable(p.he_say||p.he),"he-IL");
|
| 4843 |
+
};
|
| 4844 |
+
for(let k=0;k<topic.length&&on();k++){
|
| 4845 |
+
const id=topic[k]; openSentence(id,true); drawDrivePhrase(id);
|
| 4846 |
+
if(mode==="both"){
|
| 4847 |
+
$("status").textContent="ืขืืจืืช, ืืื ืขืจืืืช";
|
| 4848 |
+
await hebrew(id); if(!on()) break;
|
| 4849 |
+
await pause(450); await storyDriveGate(); if(!on()) break;
|
| 4850 |
+
}else $("status").textContent="ืืงืฉืืืื ืืฉืืื ืืขืจืืืช";
|
| 4851 |
+
await arabic(id); if(!on()) break;
|
| 4852 |
+
if(k<topic.length-1){
|
| 4853 |
+
const gap=mode==="arabic"?3000:900;
|
| 4854 |
+
$("status").textContent=mode==="arabic"?"ืืืฉืคื ืืื ืืขืื 3 ืฉื ืืืช":"ืืืฉืคื ืืื";
|
| 4855 |
+
await pause(gap); await storyDriveGate();
|
| 4856 |
+
}
|
| 4857 |
+
}
|
| 4858 |
+
if(on()){
|
| 4859 |
+
stopDrive();
|
| 4860 |
+
$("status").textContent="ืืฉืืื ืืกืชืืืื โ";
|
| 4861 |
+
}
|
| 4862 |
+
}
|
| 4863 |
const DRIVE_ON=$("driveBtn").innerHTML, DRIVE_OFF=DRIVE_ON.replace("i-car","i-stop").replace("ืขืืืจ ืืืฆื ื ืกืืขื","ืกืืื ื ืกืืขื");
|
| 4864 |
$("driveGo").onclick=()=>{ store.set("ihki.driveSeen",true); $("driveDlg").close(); $("driveBtn").onclick(); };
|
| 4865 |
$("driveNo").onclick=()=>$("driveDlg").close();
|
| 4866 |
+
$("storyDriveNo").onclick=()=>$("storyDriveDlg").close();
|
| 4867 |
function stopDrive(){
|
| 4868 |
+
driving=false; driveRun++; document.body.classList.remove("driving","story-driving"); $("driveBtn").innerHTML=DRIVE_ON; seatMic();
|
| 4869 |
+
storyDrivePaused=false; if(storyDriveWake){ const wake=storyDriveWake; storyDriveWake=null; wake(); }
|
| 4870 |
if(driveAudio) driveAudio.pause(); if(driveAudioDone) driveAudioDone();
|
| 4871 |
if("speechSynthesis" in window) speechSynthesis.cancel();
|
| 4872 |
if(rec&&rec.state==="recording"){ recCancel=true; rec.stop(); }
|
|
|
|
| 4874 |
if(wakeLock){ wakeLock.release().catch(()=>{}); wakeLock=null; }
|
| 4875 |
$("status").textContent="ืืืฆื ืืืืจื. ืืืงืืื ื ืขืฆืจืช ืืื ืืฉืืกืืืืื";
|
| 4876 |
}
|
| 4877 |
+
async function beginDrive(loop){
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4878 |
primeAudio(); // still inside the tap: the first sentence is heard too
|
| 4879 |
stopListen();
|
| 4880 |
if(rec&&rec.state==="recording"){ recCancel=true; rec.stop(); } // the recording that started by itself
|
| 4881 |
driving=true; document.body.classList.add("driving"); $("driveBtn").innerHTML=DRIVE_OFF; seatMic();
|
| 4882 |
hePending=null; if(heAudio) heAudio.pause();
|
| 4883 |
try{ wakeLock=await navigator.wakeLock.request("screen"); }catch{} // keep the screen on, where supported
|
| 4884 |
+
loop();
|
| 4885 |
+
}
|
| 4886 |
+
$("storyDriveArabic").onclick=()=>{ $("storyDriveDlg").close(); beginDrive(()=>driveStory("arabic")); };
|
| 4887 |
+
$("storyDriveBoth").onclick=()=>{ $("storyDriveDlg").close(); beginDrive(()=>driveStory("both")); };
|
| 4888 |
+
$("driveBtn").onclick=async()=>{
|
| 4889 |
+
if(driving){ stopDrive(); return; }
|
| 4890 |
+
if(!cur||(!isStory()&&mic.disabled)) return;
|
| 4891 |
+
quizOff();
|
| 4892 |
+
if(!store.get("ihki.driveSeen",false)){ $("driveDlg").showModal(); return; } // the first time: what the mode does, and then it starts
|
| 4893 |
+
if(isStory()){ $("storyDriveDlg").showModal(); return; }
|
| 4894 |
+
beginDrive(drive);
|
| 4895 |
};
|
| 4896 |
|
| 4897 |
/* ---------- the teacher's panel ----------
|
|
|
|
| 6443 |
let verbRecorder=null, verbChunks=[], verbRecordingUrl=null;
|
| 6444 |
async function verbRecord(btn,status,actions){
|
| 6445 |
if(verbRecorder?.state==="recording"){verbRecorder.stop();return}
|
| 6446 |
+
unlockPlayback();
|
| 6447 |
if(!navigator.mediaDevices||!window.MediaRecorder){status.textContent="ืืืคืืคื ืืื ืืื ื ืชืืื ืืืงืืื.";return}
|
| 6448 |
try{
|
| 6449 |
const stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:true,noiseSuppression:true}}), type=pickType(); verbChunks=[];
|
| 6450 |
const rec=verbRecorder=new MediaRecorder(stream,type?{mimeType:type}:{}); rec.ondataavailable=e=>{if(e.data.size)verbChunks.push(e.data)};
|
| 6451 |
rec.onstop=async()=>{stream.getTracks().forEach(t=>t.stop());btn.classList.remove("live");btn.disabled=true;status.textContent="ืืืืงโฆ";const blob=new Blob(verbChunks,{type:rec.mimeType||"audio/webm"}); if(verbRecordingUrl)URL.revokeObjectURL(verbRecordingUrl);verbRecordingUrl=URL.createObjectURL(blob);await scoreVerbSpeech(blob,btn,status,actions)};
|
| 6452 |
+
await listenCue(); rec.start();btn.classList.add("live");status.textContent="ืืงืฉืืโฆ ืืืฆื ืฉืื ืืฉืกืืืืชื";
|
| 6453 |
}catch{status.textContent="ืืื ืืืฉื ืืืืงืจืืคืื. ืืฉืจื ืืืฉื ืืืืืจืืช ืืืคืืคื."}
|
| 6454 |
}
|
| 6455 |
async function scoreVerbSpeech(blob,btn,status,actions){
|
|
|
|
| 6649 |
}
|
| 6650 |
$("labMic").onclick=async()=>{
|
| 6651 |
if(labRec&&labRec.state==="recording"){ labRec.stop(); return; }
|
| 6652 |
+
unlockPlayback();
|
| 6653 |
if(!navigator.mediaDevices||!window.MediaRecorder){ $("labStatus").textContent="ืืืคืืคื ืืื ืืื ื ืชืืื ืืืงืืื."; return; }
|
| 6654 |
let stream;
|
| 6655 |
try{ stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:true,noiseSuppression:true}}); } // as the practice records
|
|
|
|
| 6676 |
}catch(e){ $("labStatus").textContent=`ืื ืืชืื ื ืืฉื (${e.message}). ื ืกื ืฉืื.`; }
|
| 6677 |
finally{ $("labMic").disabled=false; }
|
| 6678 |
};
|
| 6679 |
+
await listenCue(); rec.start(); $("labMic").classList.add("live"); $("labStatus").textContent="ืืงืืืโฆ ืืืฆื ืฉืื ืืกืืื";
|
| 6680 |
};
|
| 6681 |
// Sound by sound: what was expected, what the model heard, the raw posterior and the final score, and whether the
|
| 6682 |
// scorer agreed with the label (a sound said right must not be flagged; the planted mistake must be)
|
|
|
|
| 6764 |
function wzFocus(){ const r=$("wzList").querySelector(".wz-row.cur"); if(r) r.scrollIntoView({block:"center",behavior:"smooth"}); }
|
| 6765 |
async function wzRecord(id){
|
| 6766 |
if(wzRec&&wzRec.state==="recording"){ if(wzRecAt===id) wzRec.stop(); return; }
|
| 6767 |
+
unlockPlayback();
|
| 6768 |
if(!wzWho()||ttsAt||wzBusy) return;
|
| 6769 |
if(!navigator.mediaDevices||!window.MediaRecorder){ wzStatus("ืืืคืืคื ืืื ืืื ื ืชืืื ืืืงืืื."); return; }
|
| 6770 |
if(wzAudio) wzAudio.pause();
|
|
|
|
| 6781 |
wzTakes[id]=new Blob(chunks,{type:rec.mimeType||"audio/webm"}); delete wzHeard[id];
|
| 6782 |
wzStatus("ืืืฉืืขโฆ ืืืจื ืืืฉืืขื: โ ืืืืฉืืจ, โ ืืืืืื."); drawWizard(); wzPlay(id);
|
| 6783 |
};
|
| 6784 |
+
await listenCue(); rec.start(); drawWizard();
|
| 6785 |
wzStatus("ืืงืืืโฆ ืืืจื ืืช ืืคืจืื. ืืืงืืื ืชืืขืฆืจ ืืื ืืฉืชืฉืชืชืงื (ืื ืืืฆื โ ).");
|
| 6786 |
vad=startVad(stream,s=>{ spoke=s; if(rec.state==="recording") rec.stop(); },VAD.noSpeech);
|
| 6787 |
setTimeout(()=>rec.state==="recording"&&rec.stop(),VAD.noSpeech+VAD.maxSpeech);
|
static/trace.html
CHANGED
|
@@ -235,7 +235,7 @@ const pct=x=>x==null?"โ":x>0&&x<.001?"<0.1%":fmt(100*x,1)+"%";
|
|
| 235 |
const band=s=>s>=75?"good":s>=50?"warn":"crit";
|
| 236 |
const BAND_NAME={good:"ืืื",warn:"ืืืขื",crit:"ืืืฉ"};
|
| 237 |
const STAGE_NAME={gop:"GOP ืืืืื",exemption:"ืคืืืจืื",insertion:"ืชืงืจืช ืฆืจืืจ",baseline:"ืงื ืืกืืก ืืืืื",calibration:"ืจืฆืคืช ืืืื",final:"ืกืืคื"};
|
| 238 |
-
const EXEMPT_NAME={glottal_dropped:"ืขืฆืืจื ืกืืชืืืช ืฉืืืฉืืื",onset_transient:"ืงืคืืฆื ืืคืจืืื ืืื ืืคื ื ืืขืืฆืืจ ืืจืืฉืื (ืืื 31)",article_vowel_elided:"ืชื ืืขืช ุงู ืืืจื ืชื ืืขื",near_vowel:"ืชื ืืขื ืงืจืืื",final_b_devoicing:"b ืกืืคืืช ืืคื ื ืขืืฆืืจ ืืืื (ืืื 28)",word_final_vowel_linking:"ืชื ืืขื ืกืืคืืช ืืคื ื ืชื ืืขื (ืืื 29)",unmarked_short_vowel:"ืชื ืืขื ืงืฆืจื ืฉืืื ื ื ืืืงืช (ืืื 30)"};
|
| 239 |
const PHONE_HEBREW={
|
| 240 |
"ส":"ื","b":"ืึผ","t":"ืช","dส":"ืืณ","ฤง":"ื","x":"ืืณ","ฯ":"ืืณ","d":"ื","r":"ืจ","ษพ":"ืจ","z":"ื",
|
| 241 |
"s":"ืก","ส":"ืฉ","sหค":"ืฆ","dหค":"ืืณ","tหค":"ื","รฐหค":"ืืณ","ส":"ืข","ษฃ":"ืขืณ","ส":"ืขืณ","f":"ืค",
|
|
|
|
| 235 |
const band=s=>s>=75?"good":s>=50?"warn":"crit";
|
| 236 |
const BAND_NAME={good:"ืืื",warn:"ืืืขื",crit:"ืืืฉ"};
|
| 237 |
const STAGE_NAME={gop:"GOP ืืืืื",exemption:"ืคืืืจืื",insertion:"ืชืงืจืช ืฆืจืืจ",baseline:"ืงื ืืกืืก ืืืืื",calibration:"ืจืฆืคืช ืืืื",final:"ืกืืคื"};
|
| 238 |
+
const EXEMPT_NAME={glottal_dropped:"ืขืฆืืจื ืกืืชืืืช ืฉืืืฉืืื",onset_transient:"ืงืคืืฆื ืืคืจืืื ืืื ืืคื ื ืืขืืฆืืจ ืืจืืฉืื (ืืื 31)",article_vowel_elided:"ืชื ืืขืช ุงู ืืืจื ืชื ืืขื",near_vowel:"ืชื ืืขื ืงืจืืื",final_b_devoicing:"b ืกืืคืืช ืืคื ื ืขืืฆืืจ ืืืื (ืืื 28)",t_d_voicing:"t ืึพd ืื ืืชืืืคืืช (ืืื 32)",word_final_vowel_linking:"ืชื ืืขื ืกืืคืืช ืืคื ื ืชื ืืขื (ืืื 29)",unmarked_short_vowel:"ืชื ืืขื ืงืฆืจื ืฉืืื ื ื ืืืงืช (ืืื 30)"};
|
| 239 |
const PHONE_HEBREW={
|
| 240 |
"ส":"ื","b":"ืึผ","t":"ืช","dส":"ืืณ","ฤง":"ื","x":"ืืณ","ฯ":"ืืณ","d":"ื","r":"ืจ","ษพ":"ืจ","z":"ื",
|
| 241 |
"s":"ืก","ส":"ืฉ","sหค":"ืฆ","dหค":"ืืณ","tหค":"ื","รฐหค":"ืืณ","ส":"ืข","ษฃ":"ืขืณ","ส":"ืขืณ","f":"ืค",
|
tests/test_scoring.py
CHANGED
|
@@ -710,6 +710,27 @@ def test_rule_28_exempts_final_b_heard_as_p_only_before_a_voiceless_onset():
|
|
| 710 |
assert no_exemption["words"][0]["phonemes"][-1]["score"] < 50
|
| 711 |
|
| 712 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 713 |
def test_rule_29_floors_a_deleted_final_short_vowel_before_a_vowel_initial_word():
|
| 714 |
phrase = {"variants": [("ุนูู ุฅูุฏู", "ส a l a | ส iห d e k")]}
|
| 715 |
scorer = custom_scorer(["iห"], ["ส", "a", "l", "ส", "iห", "d", "e", "k"])
|
|
@@ -1077,6 +1098,7 @@ def test_workbook_lesson_7():
|
|
| 1077 |
assert all(p["read"] == (p["cat"] == "l7-read") and "#" not in p["ar"] for p in pub if p["cat"].startswith("l7-"))
|
| 1078 |
by = {(p["cat"], p["he"]): p for p in PHRASES}
|
| 1079 |
assert by["l7-fem", "ืจืืืง, ืจืืืงื"]["tr"] == "ืขึทืึทูืืึดึผื, ืขึทืึทูืืึดึผืึตูื" and by["l7-dual", "ืืืื, ืฉืชื ืืืืืช"]["tr"] == "ืชึทืึฐ'ืช, ืชึทืึฐ'ืชึตืื"
|
|
|
|
| 1080 |
assert by["l7-nums", "ืืื ืฉืืขืื ืืืืฉ (175)"]["tr"] == "ืึดืึตูื ืึท'ืึฐืกึตื ืึผืกึทืึฐึผืขึดืื" # units before tens
|
| 1081 |
# 3-10: the noun in the plural and the number without its ุฉ; from 11: the noun in the singular, and 11-19 with a ืจ
|
| 1082 |
assert by["l7-count", "ืฉืืขื ืืืืื"]["tr"] == "ืกึทืึฐึผืข ืึทืึฐืึทืื" and by["l7-count", "ืฉืชืื ืขืฉืจื ืื ืืช"]["tr"] == "ืชึฐื ึทืขึฐืฉึทืจ ืึดึผื ึฐืช"
|
|
|
|
| 710 |
assert no_exemption["words"][0]["phonemes"][-1]["score"] < 50
|
| 711 |
|
| 712 |
|
| 713 |
+
def test_rule_32_exempts_t_heard_as_d_and_d_heard_as_t():
|
| 714 |
+
phrase = {"variants": [("ุงูุชู ูุชุญุชู", "i n t i | f a t a ฤง t i")]}
|
| 715 |
+
scorer = custom_scorer(["d", "f", "t", "ฤง"], ["i", "n", "d", "i", "f", "a", "t", "a", "ฤง", "t", "i"])
|
| 716 |
+
result = scorer.score(None, phrase, diagnostics=True)
|
| 717 |
+
t = next(tok for tok in result["trace"]["tokens"] if tok["ipa"] == "t")
|
| 718 |
+
assert t["competitor"] == "d"
|
| 719 |
+
assert next(s for s in t["stages"] if s["stage"] == "exemption")["applied"] == "t_d_voicing"
|
| 720 |
+
assert result["words"][0]["phonemes"][2]["score"] == 100 and not result["tips"]
|
| 721 |
+
|
| 722 |
+
scorer.set_disabled({"t_d_voicing"})
|
| 723 |
+
assert scorer.score(None, phrase)["words"][0]["phonemes"][2]["score"] < 50
|
| 724 |
+
|
| 725 |
+
# d heard as t is covered too
|
| 726 |
+
dar = custom_scorer(["d", "t", "aห", "r"], ["t", "aห", "r"]).score(None, {"variants": [("ุฏุงุฑ", "d aห r")]})
|
| 727 |
+
assert dar["words"][0]["phonemes"][0]["score"] == 100
|
| 728 |
+
|
| 729 |
+
# ... but not an emphatic: ุท heard as plain d is still judged
|
| 730 |
+
emph = custom_scorer(["d", "tหค", "aห", "r"], ["d", "aห", "r"]).score(None, {"variants": [("ุทุงุฑ", "tหค aห r")]})
|
| 731 |
+
assert emph["words"][0]["phonemes"][0]["score"] < 50
|
| 732 |
+
|
| 733 |
+
|
| 734 |
def test_rule_29_floors_a_deleted_final_short_vowel_before_a_vowel_initial_word():
|
| 735 |
phrase = {"variants": [("ุนูู ุฅูุฏู", "ส a l a | ส iห d e k")]}
|
| 736 |
scorer = custom_scorer(["iห"], ["ส", "a", "l", "ส", "iห", "d", "e", "k"])
|
|
|
|
| 1098 |
assert all(p["read"] == (p["cat"] == "l7-read") and "#" not in p["ar"] for p in pub if p["cat"].startswith("l7-"))
|
| 1099 |
by = {(p["cat"], p["he"]): p for p in PHRASES}
|
| 1100 |
assert by["l7-fem", "ืจืืืง, ืจืืืงื"]["tr"] == "ืขึทืึทูืืึดึผื, ืขึทืึทูืืึดึผืึตูื" and by["l7-dual", "ืืืื, ืฉืชื ืืืืืช"]["tr"] == "ืชึทืึฐ'ืช, ืชึทืึฐ'ืชึตืื"
|
| 1101 |
+
assert by["l7-fem", "ืจืืืง, ืจืืืงื"]["he_say"].startswith("ืจึทืึธึผืง")
|
| 1102 |
assert by["l7-nums", "ืืื ืฉืืขืื ืืืืฉ (175)"]["tr"] == "ืึดืึตูื ืึท'ืึฐืกึตื ืึผืกึทืึฐึผืขึดืื" # units before tens
|
| 1103 |
# 3-10: the noun in the plural and the number without its ุฉ; from 11: the noun in the singular, and 11-19 with a ืจ
|
| 1104 |
assert by["l7-count", "ืฉืืขื ืืืืื"]["tr"] == "ืกึทืึฐึผืข ืึทืึฐืึทืื" and by["l7-count", "ืฉืชืื ืขืฉืจื ืื ืืช"]["tr"] == "ืชึฐื ึทืขึฐืฉึทืจ ืึดึผื ึฐืช"
|