hashquiz 0.0.0-stage → 1.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/LICENSE.md +93 -0
  2. package/README.md +163 -2
  3. package/bin/hashquiz.js +6119 -0
  4. package/package.json +38 -4
  5. package/supabase/config.toml +388 -0
  6. package/supabase/functions/_shared/solo-core.js +3830 -0
  7. package/supabase/functions/solo-submit/index.ts +97 -0
  8. package/supabase/migrations/20261126090000_solo_live.sql +160 -0
  9. package/supabase/migrations/20261126120000_solo_hardening.sql +73 -0
  10. package/supabase/migrations/20261130170000_lead_details.sql +9 -0
  11. package/supabase/migrations/20261130190000_lead_segments_speaker_workshop.sql +8 -0
  12. package/web/apple-touch-icon.png +0 -0
  13. package/web/assets/LeadForm-CcX9an89.css +1 -0
  14. package/web/assets/LeadForm-DGjBIsDM.js +1 -0
  15. package/web/assets/SoloCatalog-BdJqj0PA.js +1 -0
  16. package/web/assets/SoloCatalog-C7sRyOiR.css +1 -0
  17. package/web/assets/SoloEndView-5qzjUcAy.css +1 -0
  18. package/web/assets/SoloEndView-BTon9iet.js +1 -0
  19. package/web/assets/SoloIntroView-0um497Ir.js +1 -0
  20. package/web/assets/SoloIntroView-tHv4f8e_.css +1 -0
  21. package/web/assets/SoloLeaderboard-CZv7b2Vs.css +1 -0
  22. package/web/assets/SoloLeaderboard-DlE0zaXp.js +1 -0
  23. package/web/assets/SoloQuestionView-Cf0mhxPN.css +1 -0
  24. package/web/assets/SoloQuestionView-DjeriTGW.js +65 -0
  25. package/web/assets/deps-D0OSDSrt.js +1 -0
  26. package/web/assets/format-5Txm-oDf.js +1 -0
  27. package/web/assets/index-BzQ6jGVm.css +1 -0
  28. package/web/assets/index-D3V1R50V.js +80 -0
  29. package/web/assets/solo-8S92cge3.css +1 -0
  30. package/web/assets/solo-backend-C3QJkkz_.js +1 -0
  31. package/web/favicon-32.png +0 -0
  32. package/web/favicon.svg +8 -0
  33. package/web/host/apple-touch-icon.png +0 -0
  34. package/web/host/assets/index-BU6cEGtn.js +143 -0
  35. package/web/host/assets/index-D8e4d0-q.css +1 -0
  36. package/web/host/favicon-32.png +0 -0
  37. package/web/host/favicon.svg +8 -0
  38. package/web/host/index.html +22 -0
  39. package/web/icon-192.png +0 -0
  40. package/web/icon-512.png +0 -0
  41. package/web/index.html +32 -0
  42. package/web/manifest.webmanifest +15 -0
  43. package/web/og.png +0 -0
  44. package/web/robots.txt +3 -0
package/LICENSE.md ADDED
@@ -0,0 +1,93 @@
1
+ # HashQuiz licensing
2
+
3
+ HashQuiz is **fair-code open-core**. The repository contains code under three licenses.
4
+ See [`docs/LICENSING.md`](docs/LICENSING.md) for a plain-language FAQ.
5
+
6
+ | Tier | License | Applies to |
7
+ |------|---------|------------|
8
+ | Format & tooling | [MIT](packages/parser/LICENSE) | `packages/parser/` (the `.hashquiz.md` format), `.claude/plugins/hashquiz/` (Claude skills and commands), and any future MCP server package marked MIT |
9
+ | Product | **HashQuiz Sustainable Use License** (below) | Everything else, unless stated otherwise: `packages/core`, `packages/server`, `packages/transport-*`, `packages/ui`, `packages/theme-default`, `apps/host`, `apps/player`, `decks/`, `tests/` |
10
+ | Pro / Enterprise | [HashQuiz Enterprise License](LICENSE_EE.md) | `packages/ee/`, and any file whose name contains `.ee.` or whose path contains a `.ee` directory |
11
+
12
+ When a directory contains its own `LICENSE` file, that file takes precedence for its contents.
13
+
14
+ ---
15
+
16
+ ## HashQuiz Sustainable Use License
17
+
18
+ Version 1.0
19
+
20
+ Copyright (c) 2024-present White Wood Tech
21
+
22
+ ### Acceptance
23
+
24
+ By using the software, you agree to all of the terms and conditions below.
25
+
26
+ ### Copyright license
27
+
28
+ The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to
29
+ use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the
30
+ limitations below.
31
+
32
+ ### Limitations
33
+
34
+ 1. You may use or modify the software only:
35
+ - for your own internal business purposes;
36
+ - for personal or non-commercial purposes; or
37
+ - to host and run quiz sessions for your own audiences — including paid trainings, courses, workshops,
38
+ conferences and events that you or your organization deliver.
39
+ 2. You may not provide the software to third parties as a hosted or managed service, where those third parties
40
+ create, host or run their own quizzes or quiz sessions through your deployment of the software, whether or not
41
+ you charge for it.
42
+ 3. You may not sell, resell, rent, white-label or embed the software, or a derivative work of it, in a product or
43
+ service offered to third parties, except under a separate commercial agreement with the licensor.
44
+ 4. You may distribute the software or provide it to others only if you do so free of charge for non-commercial
45
+ purposes.
46
+ 5. You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the
47
+ software, and you may not move, change, disable, or circumvent the license key functionality.
48
+
49
+ ### Notices
50
+
51
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
52
+ If you modify the software, you must include in any modified copies a prominent notice stating that you have
53
+ modified the software.
54
+
55
+ ### Patents
56
+
57
+ The licensor grants you a license, under any patent claims the licensor can license or becomes able to license,
58
+ to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the
59
+ limitations and conditions in this license. This license does not cover any patent claims that you cause to be
60
+ infringed by modifications or additions to the software. If you or your company make any written claim that the
61
+ software infringes or contributes to infringement of any patent, your patent license for the software granted
62
+ under these terms ends immediately.
63
+
64
+ ### No other rights
65
+
66
+ These terms do not imply any licenses other than those expressly granted in these terms.
67
+
68
+ ### Termination
69
+
70
+ If you use the software in violation of these terms, such use is not licensed, and your license will automatically
71
+ terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this
72
+ license no later than 30 days after you receive that notice, your license will be reinstated retroactively.
73
+ However, if you violate these terms after such reinstatement, any additional violation of these terms will cause
74
+ your license to terminate automatically and permanently.
75
+
76
+ ### No liability
77
+
78
+ As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not
79
+ be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind
80
+ of legal claim.
81
+
82
+ ### Definitions
83
+
84
+ - The **licensor** is the entity offering these terms.
85
+ - The **software** is the software the licensor makes available under these terms, including any portion of it.
86
+ - **You** refers to the individual or entity agreeing to these terms.
87
+ - **Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus
88
+ all organizations that have control over, are under the control of, or are under common control with that
89
+ organization. Control means ownership of substantially all the assets of an entity, or the power to direct its
90
+ management and policies by vote, contract, or otherwise.
91
+ - **Your license** is the license granted to you for the software under these terms.
92
+ - **Use** means anything you do with the software requiring your license.
93
+ - **Trademark** means trademarks, service marks, and similar rights.
package/README.md CHANGED
@@ -1,3 +1,164 @@
1
- # Temporary Holding Version
1
+ # hashquiz
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Real-time multiplayer quiz (a Kahoot alternative) driven by Markdown decks.
4
+ This package ships the `hashquiz` CLI and the prebuilt host and player web apps,
5
+ so a repository only needs its decks.
6
+
7
+ Requires [Bun](https://bun.sh) 1.1 or later.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ bun add -d hashquiz@beta # prereleases until 1.0.0
13
+ ```
14
+
15
+ ## Decks repository layout
16
+
17
+ ```text
18
+ decks/
19
+ my-deck/
20
+ index.hashquiz.md
21
+ package.json
22
+ vercel.json
23
+ ```
24
+
25
+ Format reference: [deck format](https://github.com/WhiteWoodTech/hashquiz/blob/develop/docs/TECHNICAL_GUIDE.md).
26
+
27
+ ## Commands
28
+
29
+ ```bash
30
+ hashquiz check decks/my-deck/index.hashquiz.md # validate one deck
31
+ hashquiz dev decks/my-deck/index.hashquiz.md # local game: host :3031/host/, players :3032
32
+ hashquiz dev decks # same, a folder: solo decks folder, room deck = first deck by id
33
+ hashquiz build decks --out dist # static site with every deck under decks/
34
+ hashquiz build decks --public public # same, with extra files copied to the site root
35
+ hashquiz supabase deploy --project <ref> # solo backend on a Supabase project
36
+ ```
37
+
38
+ `build` validates every `*.hashquiz.md` under the folder, copies the apps and
39
+ writes `host/decks.json` (host deck list), the same `decks.json` at the root
40
+ (player solo decks) and `hashquiz-config.js`. It reads the deployment settings
41
+ from the environment:
42
+
43
+ | Variable | Value |
44
+ | --- | --- |
45
+ | `HASHQUIZ_TRANSPORT` | `supabase` for a hosted game (default `local`) |
46
+ | `HASHQUIZ_SUPABASE_URL` | Supabase project URL |
47
+ | `HASHQUIZ_SUPABASE_ANON_KEY` | Supabase anon public key |
48
+ | `HASHQUIZ_SOLO_SCORING` | Solo run scoring: `browser` (default) or `edge` |
49
+ | `HASHQUIZ_PLAYER_URL` | Optional player URL for the host's solo links (default: same origin) |
50
+ | `HASHQUIZ_SITE_URL` | Public URL of the site (e.g. `https://hashquiz.ai`): canonical, `og:url`, absolute `og:image`, sitemap line of `robots.txt` |
51
+ | `HASHQUIZ_LANG` | `<html lang>` of the player page, e.g. `fr` (default `en`) |
52
+ | `HASHQUIZ_INDEXABLE` | `true` lets search engines index the player page (default: `noindex`). The host is always `noindex` |
53
+ | `HASHQUIZ_CATALOG` | `true` writes the public quiz catalogue (below). Off by default: each deploy decides to list its decks |
54
+
55
+ ### Search engines and link previews
56
+
57
+ The player page ships a description, Open Graph tags and a 1200×630 `og.png`, a web app manifest and its icons.
58
+ `build` also writes a `robots.txt` that keeps `/host` out of search engines.
59
+
60
+ Files in `public/` (or the folder given with `--public`) are copied to the site root last, so a decks repository
61
+ can add `llms.txt` or `sitemap.xml`, or replace `og.png` and `robots.txt`. The `Sitemap:` line of the generated
62
+ `robots.txt` appears only when `public/` holds a `sitemap.xml` and `HASHQUIZ_SITE_URL` is set.
63
+ With `HASHQUIZ_CATALOG=true`, `build` also writes a public catalogue in plain HTML, readable by search engines and
64
+ AI assistants without JavaScript:
65
+
66
+ | Path | Content |
67
+ | --- | --- |
68
+ | `/quiz/` | Every deck: title, description, tags, difficulty, number of questions |
69
+ | `/quiz/<slug>/` | One deck: description, author, tags, difficulty, links to host it and play it solo (`solo: true`) |
70
+ | `/quiz/tag/<tag>/` | The decks carrying a tag |
71
+ | `/404.html` | Not-found page linking to the catalogue |
72
+ | `/sitemap.xml` | Every catalogue page, when `HASHQUIZ_SITE_URL` is set (a `public/sitemap.xml` replaces it) |
73
+
74
+ No page shows a question or an answer. The pages carry JSON-LD (`ItemList`, `Quiz`, `BreadcrumbList`).
75
+ The slug comes from the deck folder (`decks/docker-basics/index.hashquiz.md` → `docker-basics`).
76
+ Labels are in French when `HASHQUIZ_LANG` starts with `fr`, in English otherwise.
77
+
78
+ Background: [SEO audit](https://github.com/WhiteWoodTech/hashquiz/blob/develop/docs/SEO_AUDIT.md).
79
+
80
+ ### Theme
81
+
82
+ A `public/theme.css` restyles the site without forking the engine: `build` (and `dev` from the package) links it
83
+ last in the player and host pages, so a `:root` block there overrides the `--hq-*` tokens (colors, fonts, radii,
84
+ offset shadows, particles). Replace `favicon.svg` (and `favicon-32.png`, `apple-touch-icon.png`) the same way.
85
+ Token list: [design system](https://github.com/WhiteWoodTech/hashquiz/blob/develop/docs/DESIGN_SYSTEM.md#deck-repository-theme).
86
+
87
+ ```css
88
+ /* public/theme.css */
89
+ @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');
90
+ :root {
91
+ --hq-bg: #1a1e1f;
92
+ --hq-accent: #5c7063;
93
+ --hq-font-display: 'Roboto', system-ui, sans-serif;
94
+ }
95
+ ```
96
+
97
+ The `VITE_*` names (`VITE_TRANSPORT`, …) are accepted too. The prebuilt apps carry no
98
+ settings of their own: whatever `hashquiz-config.js` says (including `local` and `browser`) is what they use.
99
+
100
+ Decks with `solo: true` in their frontmatter can also be played alone from
101
+ the player app. `hashquiz dev` serves solo on its own (port 3030): runs are stored in `.hashquiz/solo.db` of
102
+ the working directory (add `.hashquiz/` to `.gitignore`) and rescored by the server. The leaderboard exists only
103
+ on the machine running the server and the players must reach its port 3030, so it does not work for an https
104
+ static deploy (on an `https:` page the apps hide local solo). If `.hashquiz/solo.db` cannot be opened, the
105
+ server warns and runs rooms without solo. When a deck changes during a run, the score is not stored and the end
106
+ screen offers « Rejouer » with the new version. With `--decks <dir>` and a file, the solo decks come from that
107
+ folder. For a hosted site use the Supabase backend (see the hashquiz `docs/DEPLOY.md`).
108
+
109
+ ## Deploy the solo backend on Supabase
110
+
111
+ The package ships the Supabase project (`supabase/`: migrations, the `solo-submit` Edge Function and its
112
+ prebuilt core). After `hashquiz build`, deploy it with:
113
+
114
+ ```bash
115
+ HASHQUIZ_SITE_URL=https://<domain> hashquiz supabase deploy --project <project-ref> [--dry-run]
116
+ ```
117
+
118
+ It stages the project in a temp folder and runs `supabase link`, `supabase db push --remote`,
119
+ `supabase functions deploy solo-submit` and `supabase secrets set HASHQUIZ_SITE_URL=…`, stopping at the first
120
+ failure. The function reads `<HASHQUIZ_SITE_URL>/decks.json` at runtime, so deck changes need no redeploy.
121
+ `--site-url <url>` overrides `HASHQUIZ_SITE_URL` (an http(s) URL). It needs the
122
+ [Supabase CLI](https://supabase.com/docs/guides/cli) on `PATH` (or `SUPABASE_BIN`), plus
123
+ `SUPABASE_ACCESS_TOKEN` and `SUPABASE_DB_PASSWORD` in the environment (CI secrets). `--dry-run` prints the
124
+ steps without running them. The command never changes `solo_settings`: switching to edge scoring means setting
125
+ `HASHQUIZ_SOLO_SCORING=edge` for `hashquiz build` **and** running
126
+ `update solo_settings set scoring_mode = 'edge'` once.
127
+
128
+ Typical CI of a decks repository (secrets `SUPABASE_ACCESS_TOKEN`, `SUPABASE_DB_PASSWORD`, `HASHQUIZ_SITE_URL`):
129
+
130
+ ```bash
131
+ hashquiz build decks --out dist
132
+ hashquiz supabase deploy --project <project-ref>
133
+ ```
134
+
135
+ ## Deploy on Vercel
136
+
137
+ `package.json`:
138
+
139
+ ```json
140
+ {
141
+ "scripts": { "build": "hashquiz build decks --out dist" },
142
+ "devDependencies": { "hashquiz": "^1.0.0-beta.2" }
143
+ }
144
+ ```
145
+
146
+ `vercel.json`:
147
+
148
+ ```json
149
+ {
150
+ "buildCommand": "bun run build",
151
+ "outputDirectory": "dist",
152
+ "framework": null,
153
+ "rewrites": [
154
+ { "source": "/host", "destination": "/host/index.html" },
155
+ { "source": "/host/(.*)", "destination": "/host/$1" },
156
+ { "source": "/((?!host/|host$).*)", "destination": "/$1" }
157
+ ]
158
+ }
159
+ ```
160
+
161
+ Set the three variables above in the Vercel project, then:
162
+
163
+ - `https://<domain>/` is the player join page
164
+ - `https://<domain>/host` is the host dashboard