@shaykec/bridge 0.4.24 → 0.4.26

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 (320) hide show
  1. package/journeys/ai-engineer.yaml +34 -0
  2. package/journeys/backend-developer.yaml +36 -0
  3. package/journeys/business-analyst.yaml +37 -0
  4. package/journeys/devops-engineer.yaml +37 -0
  5. package/journeys/engineering-manager.yaml +44 -0
  6. package/journeys/frontend-developer.yaml +41 -0
  7. package/journeys/fullstack-developer.yaml +49 -0
  8. package/journeys/mobile-developer.yaml +42 -0
  9. package/journeys/product-manager.yaml +35 -0
  10. package/journeys/qa-engineer.yaml +37 -0
  11. package/journeys/ux-designer.yaml +43 -0
  12. package/modules/README.md +52 -0
  13. package/modules/accessibility-fundamentals/content.md +126 -0
  14. package/modules/accessibility-fundamentals/exercises.md +88 -0
  15. package/modules/accessibility-fundamentals/module.yaml +43 -0
  16. package/modules/accessibility-fundamentals/quick-ref.md +71 -0
  17. package/modules/accessibility-fundamentals/quiz.md +100 -0
  18. package/modules/accessibility-fundamentals/resources.md +29 -0
  19. package/modules/accessibility-fundamentals/walkthrough.md +80 -0
  20. package/modules/adr-writing/content.md +121 -0
  21. package/modules/adr-writing/exercises.md +81 -0
  22. package/modules/adr-writing/module.yaml +41 -0
  23. package/modules/adr-writing/quick-ref.md +57 -0
  24. package/modules/adr-writing/quiz.md +73 -0
  25. package/modules/adr-writing/resources.md +29 -0
  26. package/modules/adr-writing/walkthrough.md +64 -0
  27. package/modules/ai-agents/content.md +120 -0
  28. package/modules/ai-agents/exercises.md +82 -0
  29. package/modules/ai-agents/module.yaml +42 -0
  30. package/modules/ai-agents/quick-ref.md +60 -0
  31. package/modules/ai-agents/quiz.md +103 -0
  32. package/modules/ai-agents/resources.md +30 -0
  33. package/modules/ai-agents/walkthrough.md +85 -0
  34. package/modules/ai-assisted-research/content.md +136 -0
  35. package/modules/ai-assisted-research/exercises.md +80 -0
  36. package/modules/ai-assisted-research/module.yaml +42 -0
  37. package/modules/ai-assisted-research/quick-ref.md +67 -0
  38. package/modules/ai-assisted-research/quiz.md +73 -0
  39. package/modules/ai-assisted-research/resources.md +33 -0
  40. package/modules/ai-assisted-research/walkthrough.md +85 -0
  41. package/modules/ai-pair-programming/content.md +105 -0
  42. package/modules/ai-pair-programming/exercises.md +98 -0
  43. package/modules/ai-pair-programming/module.yaml +39 -0
  44. package/modules/ai-pair-programming/quick-ref.md +58 -0
  45. package/modules/ai-pair-programming/quiz.md +73 -0
  46. package/modules/ai-pair-programming/resources.md +34 -0
  47. package/modules/ai-pair-programming/walkthrough.md +117 -0
  48. package/modules/ai-test-generation/content.md +125 -0
  49. package/modules/ai-test-generation/exercises.md +98 -0
  50. package/modules/ai-test-generation/module.yaml +39 -0
  51. package/modules/ai-test-generation/quick-ref.md +65 -0
  52. package/modules/ai-test-generation/quiz.md +74 -0
  53. package/modules/ai-test-generation/resources.md +41 -0
  54. package/modules/ai-test-generation/walkthrough.md +100 -0
  55. package/modules/api-design/content.md +189 -0
  56. package/modules/api-design/exercises.md +84 -0
  57. package/modules/api-design/game.yaml +113 -0
  58. package/modules/api-design/module.yaml +45 -0
  59. package/modules/api-design/quick-ref.md +73 -0
  60. package/modules/api-design/quiz.md +100 -0
  61. package/modules/api-design/resources.md +55 -0
  62. package/modules/api-design/walkthrough.md +88 -0
  63. package/modules/clean-code/content.md +136 -0
  64. package/modules/clean-code/exercises.md +137 -0
  65. package/modules/clean-code/game.yaml +172 -0
  66. package/modules/clean-code/module.yaml +44 -0
  67. package/modules/clean-code/quick-ref.md +44 -0
  68. package/modules/clean-code/quiz.md +105 -0
  69. package/modules/clean-code/resources.md +40 -0
  70. package/modules/clean-code/walkthrough.md +78 -0
  71. package/modules/clean-code/workshop.yaml +149 -0
  72. package/modules/code-review/content.md +130 -0
  73. package/modules/code-review/exercises.md +95 -0
  74. package/modules/code-review/game.yaml +83 -0
  75. package/modules/code-review/module.yaml +42 -0
  76. package/modules/code-review/quick-ref.md +77 -0
  77. package/modules/code-review/quiz.md +105 -0
  78. package/modules/code-review/resources.md +40 -0
  79. package/modules/code-review/walkthrough.md +106 -0
  80. package/modules/daily-workflow/content.md +81 -0
  81. package/modules/daily-workflow/exercises.md +50 -0
  82. package/modules/daily-workflow/module.yaml +33 -0
  83. package/modules/daily-workflow/quick-ref.md +37 -0
  84. package/modules/daily-workflow/quiz.md +65 -0
  85. package/modules/daily-workflow/resources.md +38 -0
  86. package/modules/daily-workflow/walkthrough.md +83 -0
  87. package/modules/debugging-systematically/content.md +139 -0
  88. package/modules/debugging-systematically/exercises.md +91 -0
  89. package/modules/debugging-systematically/module.yaml +46 -0
  90. package/modules/debugging-systematically/quick-ref.md +59 -0
  91. package/modules/debugging-systematically/quiz.md +105 -0
  92. package/modules/debugging-systematically/resources.md +42 -0
  93. package/modules/debugging-systematically/walkthrough.md +84 -0
  94. package/modules/debugging-systematically/workshop.yaml +127 -0
  95. package/modules/demo-test/content.md +68 -0
  96. package/modules/demo-test/exercises.md +28 -0
  97. package/modules/demo-test/game.yaml +171 -0
  98. package/modules/demo-test/module.yaml +41 -0
  99. package/modules/demo-test/quick-ref.md +54 -0
  100. package/modules/demo-test/quiz.md +74 -0
  101. package/modules/demo-test/resources.md +21 -0
  102. package/modules/demo-test/walkthrough.md +122 -0
  103. package/modules/demo-test/workshop.yaml +31 -0
  104. package/modules/design-critique/content.md +93 -0
  105. package/modules/design-critique/exercises.md +71 -0
  106. package/modules/design-critique/module.yaml +41 -0
  107. package/modules/design-critique/quick-ref.md +63 -0
  108. package/modules/design-critique/quiz.md +73 -0
  109. package/modules/design-critique/resources.md +27 -0
  110. package/modules/design-critique/walkthrough.md +68 -0
  111. package/modules/design-patterns/content.md +335 -0
  112. package/modules/design-patterns/exercises.md +82 -0
  113. package/modules/design-patterns/game.yaml +55 -0
  114. package/modules/design-patterns/module.yaml +45 -0
  115. package/modules/design-patterns/quick-ref.md +44 -0
  116. package/modules/design-patterns/quiz.md +101 -0
  117. package/modules/design-patterns/resources.md +40 -0
  118. package/modules/design-patterns/walkthrough.md +64 -0
  119. package/modules/exploratory-testing/content.md +133 -0
  120. package/modules/exploratory-testing/exercises.md +88 -0
  121. package/modules/exploratory-testing/module.yaml +41 -0
  122. package/modules/exploratory-testing/quick-ref.md +68 -0
  123. package/modules/exploratory-testing/quiz.md +75 -0
  124. package/modules/exploratory-testing/resources.md +39 -0
  125. package/modules/exploratory-testing/walkthrough.md +87 -0
  126. package/modules/git/content.md +128 -0
  127. package/modules/git/exercises.md +53 -0
  128. package/modules/git/game.yaml +190 -0
  129. package/modules/git/module.yaml +44 -0
  130. package/modules/git/quick-ref.md +67 -0
  131. package/modules/git/quiz.md +89 -0
  132. package/modules/git/resources.md +49 -0
  133. package/modules/git/walkthrough.md +92 -0
  134. package/modules/git/workshop.yaml +145 -0
  135. package/modules/hiring-interviews/content.md +130 -0
  136. package/modules/hiring-interviews/exercises.md +88 -0
  137. package/modules/hiring-interviews/module.yaml +41 -0
  138. package/modules/hiring-interviews/quick-ref.md +68 -0
  139. package/modules/hiring-interviews/quiz.md +73 -0
  140. package/modules/hiring-interviews/resources.md +36 -0
  141. package/modules/hiring-interviews/walkthrough.md +75 -0
  142. package/modules/hooks/content.md +97 -0
  143. package/modules/hooks/exercises.md +69 -0
  144. package/modules/hooks/module.yaml +39 -0
  145. package/modules/hooks/quick-ref.md +93 -0
  146. package/modules/hooks/quiz.md +81 -0
  147. package/modules/hooks/resources.md +34 -0
  148. package/modules/hooks/walkthrough.md +105 -0
  149. package/modules/hooks/workshop.yaml +64 -0
  150. package/modules/incident-response/content.md +124 -0
  151. package/modules/incident-response/exercises.md +82 -0
  152. package/modules/incident-response/game.yaml +132 -0
  153. package/modules/incident-response/module.yaml +45 -0
  154. package/modules/incident-response/quick-ref.md +53 -0
  155. package/modules/incident-response/quiz.md +103 -0
  156. package/modules/incident-response/resources.md +40 -0
  157. package/modules/incident-response/walkthrough.md +82 -0
  158. package/modules/llm-fundamentals/content.md +114 -0
  159. package/modules/llm-fundamentals/exercises.md +83 -0
  160. package/modules/llm-fundamentals/module.yaml +42 -0
  161. package/modules/llm-fundamentals/quick-ref.md +64 -0
  162. package/modules/llm-fundamentals/quiz.md +103 -0
  163. package/modules/llm-fundamentals/resources.md +30 -0
  164. package/modules/llm-fundamentals/walkthrough.md +91 -0
  165. package/modules/one-on-ones/content.md +133 -0
  166. package/modules/one-on-ones/exercises.md +81 -0
  167. package/modules/one-on-ones/module.yaml +44 -0
  168. package/modules/one-on-ones/quick-ref.md +67 -0
  169. package/modules/one-on-ones/quiz.md +73 -0
  170. package/modules/one-on-ones/resources.md +37 -0
  171. package/modules/one-on-ones/walkthrough.md +69 -0
  172. package/modules/package.json +9 -0
  173. package/modules/prioritization-frameworks/content.md +130 -0
  174. package/modules/prioritization-frameworks/exercises.md +93 -0
  175. package/modules/prioritization-frameworks/module.yaml +41 -0
  176. package/modules/prioritization-frameworks/quick-ref.md +77 -0
  177. package/modules/prioritization-frameworks/quiz.md +73 -0
  178. package/modules/prioritization-frameworks/resources.md +32 -0
  179. package/modules/prioritization-frameworks/walkthrough.md +69 -0
  180. package/modules/prompt-engineering/content.md +123 -0
  181. package/modules/prompt-engineering/exercises.md +82 -0
  182. package/modules/prompt-engineering/game.yaml +101 -0
  183. package/modules/prompt-engineering/module.yaml +45 -0
  184. package/modules/prompt-engineering/quick-ref.md +65 -0
  185. package/modules/prompt-engineering/quiz.md +105 -0
  186. package/modules/prompt-engineering/resources.md +36 -0
  187. package/modules/prompt-engineering/walkthrough.md +81 -0
  188. package/modules/rag-fundamentals/content.md +111 -0
  189. package/modules/rag-fundamentals/exercises.md +80 -0
  190. package/modules/rag-fundamentals/module.yaml +45 -0
  191. package/modules/rag-fundamentals/quick-ref.md +58 -0
  192. package/modules/rag-fundamentals/quiz.md +75 -0
  193. package/modules/rag-fundamentals/resources.md +34 -0
  194. package/modules/rag-fundamentals/walkthrough.md +75 -0
  195. package/modules/react-fundamentals/content.md +140 -0
  196. package/modules/react-fundamentals/exercises.md +81 -0
  197. package/modules/react-fundamentals/game.yaml +145 -0
  198. package/modules/react-fundamentals/module.yaml +45 -0
  199. package/modules/react-fundamentals/quick-ref.md +62 -0
  200. package/modules/react-fundamentals/quiz.md +106 -0
  201. package/modules/react-fundamentals/resources.md +42 -0
  202. package/modules/react-fundamentals/walkthrough.md +89 -0
  203. package/modules/react-fundamentals/workshop.yaml +112 -0
  204. package/modules/react-native-fundamentals/content.md +141 -0
  205. package/modules/react-native-fundamentals/exercises.md +79 -0
  206. package/modules/react-native-fundamentals/module.yaml +42 -0
  207. package/modules/react-native-fundamentals/quick-ref.md +60 -0
  208. package/modules/react-native-fundamentals/quiz.md +61 -0
  209. package/modules/react-native-fundamentals/resources.md +24 -0
  210. package/modules/react-native-fundamentals/walkthrough.md +84 -0
  211. package/modules/registry.yaml +1650 -0
  212. package/modules/risk-management/content.md +162 -0
  213. package/modules/risk-management/exercises.md +86 -0
  214. package/modules/risk-management/module.yaml +41 -0
  215. package/modules/risk-management/quick-ref.md +82 -0
  216. package/modules/risk-management/quiz.md +73 -0
  217. package/modules/risk-management/resources.md +40 -0
  218. package/modules/risk-management/walkthrough.md +67 -0
  219. package/modules/running-effective-standups/content.md +119 -0
  220. package/modules/running-effective-standups/exercises.md +79 -0
  221. package/modules/running-effective-standups/module.yaml +40 -0
  222. package/modules/running-effective-standups/quick-ref.md +61 -0
  223. package/modules/running-effective-standups/quiz.md +73 -0
  224. package/modules/running-effective-standups/resources.md +36 -0
  225. package/modules/running-effective-standups/walkthrough.md +76 -0
  226. package/modules/solid-principles/content.md +154 -0
  227. package/modules/solid-principles/exercises.md +107 -0
  228. package/modules/solid-principles/module.yaml +42 -0
  229. package/modules/solid-principles/quick-ref.md +50 -0
  230. package/modules/solid-principles/quiz.md +102 -0
  231. package/modules/solid-principles/resources.md +39 -0
  232. package/modules/solid-principles/walkthrough.md +84 -0
  233. package/modules/sprint-planning/content.md +142 -0
  234. package/modules/sprint-planning/exercises.md +79 -0
  235. package/modules/sprint-planning/game.yaml +84 -0
  236. package/modules/sprint-planning/module.yaml +44 -0
  237. package/modules/sprint-planning/quick-ref.md +76 -0
  238. package/modules/sprint-planning/quiz.md +102 -0
  239. package/modules/sprint-planning/resources.md +39 -0
  240. package/modules/sprint-planning/walkthrough.md +75 -0
  241. package/modules/sql-fundamentals/content.md +160 -0
  242. package/modules/sql-fundamentals/exercises.md +87 -0
  243. package/modules/sql-fundamentals/game.yaml +105 -0
  244. package/modules/sql-fundamentals/module.yaml +45 -0
  245. package/modules/sql-fundamentals/quick-ref.md +53 -0
  246. package/modules/sql-fundamentals/quiz.md +103 -0
  247. package/modules/sql-fundamentals/resources.md +42 -0
  248. package/modules/sql-fundamentals/walkthrough.md +92 -0
  249. package/modules/sql-fundamentals/workshop.yaml +109 -0
  250. package/modules/stakeholder-communication/content.md +186 -0
  251. package/modules/stakeholder-communication/exercises.md +87 -0
  252. package/modules/stakeholder-communication/module.yaml +38 -0
  253. package/modules/stakeholder-communication/quick-ref.md +89 -0
  254. package/modules/stakeholder-communication/quiz.md +73 -0
  255. package/modules/stakeholder-communication/resources.md +41 -0
  256. package/modules/stakeholder-communication/walkthrough.md +74 -0
  257. package/modules/system-design/content.md +149 -0
  258. package/modules/system-design/exercises.md +83 -0
  259. package/modules/system-design/game.yaml +95 -0
  260. package/modules/system-design/module.yaml +46 -0
  261. package/modules/system-design/quick-ref.md +59 -0
  262. package/modules/system-design/quiz.md +102 -0
  263. package/modules/system-design/resources.md +46 -0
  264. package/modules/system-design/walkthrough.md +90 -0
  265. package/modules/team-topologies/content.md +166 -0
  266. package/modules/team-topologies/exercises.md +85 -0
  267. package/modules/team-topologies/module.yaml +41 -0
  268. package/modules/team-topologies/quick-ref.md +61 -0
  269. package/modules/team-topologies/quiz.md +101 -0
  270. package/modules/team-topologies/resources.md +37 -0
  271. package/modules/team-topologies/walkthrough.md +76 -0
  272. package/modules/technical-debt/content.md +111 -0
  273. package/modules/technical-debt/exercises.md +92 -0
  274. package/modules/technical-debt/module.yaml +39 -0
  275. package/modules/technical-debt/quick-ref.md +60 -0
  276. package/modules/technical-debt/quiz.md +73 -0
  277. package/modules/technical-debt/resources.md +25 -0
  278. package/modules/technical-debt/walkthrough.md +94 -0
  279. package/modules/technical-mentoring/content.md +128 -0
  280. package/modules/technical-mentoring/exercises.md +84 -0
  281. package/modules/technical-mentoring/module.yaml +41 -0
  282. package/modules/technical-mentoring/quick-ref.md +74 -0
  283. package/modules/technical-mentoring/quiz.md +73 -0
  284. package/modules/technical-mentoring/resources.md +33 -0
  285. package/modules/technical-mentoring/walkthrough.md +65 -0
  286. package/modules/test-strategy/content.md +136 -0
  287. package/modules/test-strategy/exercises.md +84 -0
  288. package/modules/test-strategy/game.yaml +99 -0
  289. package/modules/test-strategy/module.yaml +45 -0
  290. package/modules/test-strategy/quick-ref.md +66 -0
  291. package/modules/test-strategy/quiz.md +99 -0
  292. package/modules/test-strategy/resources.md +60 -0
  293. package/modules/test-strategy/walkthrough.md +97 -0
  294. package/modules/test-strategy/workshop.yaml +96 -0
  295. package/modules/typescript-fundamentals/content.md +127 -0
  296. package/modules/typescript-fundamentals/exercises.md +79 -0
  297. package/modules/typescript-fundamentals/game.yaml +111 -0
  298. package/modules/typescript-fundamentals/module.yaml +45 -0
  299. package/modules/typescript-fundamentals/quick-ref.md +55 -0
  300. package/modules/typescript-fundamentals/quiz.md +104 -0
  301. package/modules/typescript-fundamentals/resources.md +42 -0
  302. package/modules/typescript-fundamentals/walkthrough.md +71 -0
  303. package/modules/typescript-fundamentals/workshop.yaml +146 -0
  304. package/modules/user-story-mapping/content.md +123 -0
  305. package/modules/user-story-mapping/exercises.md +87 -0
  306. package/modules/user-story-mapping/module.yaml +41 -0
  307. package/modules/user-story-mapping/quick-ref.md +64 -0
  308. package/modules/user-story-mapping/quiz.md +73 -0
  309. package/modules/user-story-mapping/resources.md +29 -0
  310. package/modules/user-story-mapping/walkthrough.md +86 -0
  311. package/modules/writing-prds/content.md +133 -0
  312. package/modules/writing-prds/exercises.md +93 -0
  313. package/modules/writing-prds/game.yaml +83 -0
  314. package/modules/writing-prds/module.yaml +44 -0
  315. package/modules/writing-prds/quick-ref.md +77 -0
  316. package/modules/writing-prds/quiz.md +103 -0
  317. package/modules/writing-prds/resources.md +30 -0
  318. package/modules/writing-prds/walkthrough.md +87 -0
  319. package/package.json +5 -3
  320. package/src/server.js +17 -7
@@ -0,0 +1,127 @@
1
+ scenarios:
2
+ - id: null-reference
3
+ title: "Fix a Null/Undefined Crash"
4
+ difficulty: beginner
5
+ xp: 25
6
+ setup:
7
+ - "mkdir -p workshop && cd workshop"
8
+ - "npm init -y"
9
+ files:
10
+ - name: app.js
11
+ content: |
12
+ const user = { id: 1, profile: null };
13
+ function greet(user) {
14
+ return `Hello, ${user.profile.name}!`;
15
+ }
16
+ try {
17
+ console.log(greet(user));
18
+ } catch (e) {
19
+ console.error('Error:', e.message);
20
+ }
21
+ language: javascript
22
+ readonly: false
23
+ task: "Run node app.js. The program crashes because user.profile is null and we access user.profile.name. Find and fix the null reference so the program runs without error."
24
+ validations:
25
+ - label: "Program runs and prints a greeting"
26
+ check: output-contains
27
+ pattern: "Hello"
28
+ hints:
29
+ - "What value is user.profile when the crash happens? How could you guard before accessing .name?"
30
+ - "Options: check if profile exists before using it, use optional chaining (user.profile?.name), or provide a default."
31
+ - "Consider: user.profile ? user.profile.name : 'Guest' or user.profile?.name ?? 'Guest'."
32
+ agent_prompts:
33
+ on_start: "What happens when you try to read a property of null? How would you discover that without seeing the code?"
34
+
35
+ - id: async-race
36
+ title: "Fix an Async Race Condition"
37
+ difficulty: intermediate
38
+ xp: 35
39
+ setup:
40
+ - "mkdir -p workshop && cd workshop"
41
+ - "npm init -y"
42
+ files:
43
+ - name: fetchData.js
44
+ content: |
45
+ async function fetchUser(id) {
46
+ return new Promise(resolve => setTimeout(() => resolve({ id, name: 'User ' + id }), 100));
47
+ }
48
+ async function fetchOrders(userId) {
49
+ return new Promise(resolve => setTimeout(() => resolve([{ orderId: 1 }, { orderId: 2 }]), 150));
50
+ }
51
+ async function run() {
52
+ const user = fetchUser(1);
53
+ const orders = fetchOrders(1);
54
+ console.log('User:', user);
55
+ console.log('Orders:', orders);
56
+ console.log('Done');
57
+ }
58
+ run();
59
+ language: javascript
60
+ readonly: false
61
+ task: "Run node fetchData.js. The output shows Promise objects instead of data because we use the results before the promises resolve. Fix the timing so both fetches complete before we log, and the output shows the actual user and orders."
62
+ validations:
63
+ - label: "fetchData.js was modified"
64
+ check: file-changed
65
+ pattern: "fetchData.js"
66
+ - label: "Output shows user and orders data"
67
+ check: output-contains
68
+ pattern: "User:"
69
+ hints:
70
+ - "fetchUser and fetchOrders return Promises. We need to wait for them before using the results."
71
+ - "Use await on each call, or await Promise.all([user, orders]) to wait for both."
72
+ - "Ensure run() awaits the fetches before console.log."
73
+ agent_prompts:
74
+ on_start: "What's the difference between calling fetchUser(1) and awaiting it? When does the data become available?"
75
+
76
+ - id: off-by-one
77
+ title: "Fix an Off-by-One Error in Pagination"
78
+ difficulty: intermediate
79
+ xp: 30
80
+ setup:
81
+ - "mkdir -p workshop && cd workshop"
82
+ - "npm init -y"
83
+ files:
84
+ - name: pagination.js
85
+ content: |
86
+ function getPageRange(totalItems, itemsPerPage, page) {
87
+ const totalPages = Math.ceil(totalItems / itemsPerPage);
88
+ if (page < 1 || page > totalPages) return null;
89
+ const start = (page - 1) * itemsPerPage;
90
+ const end = start + itemsPerPage;
91
+ return { start, end };
92
+ }
93
+ module.exports = { getPageRange };
94
+ language: javascript
95
+ readonly: false
96
+ - name: pagination.test.js
97
+ content: |
98
+ const { getPageRange } = require('./pagination');
99
+ function runTests() {
100
+ let passed = 0;
101
+ let failed = 0;
102
+ const tests = [
103
+ () => { const r = getPageRange(25, 10, 1); if (r && r.start === 0 && r.end === 10) passed++; else failed++; },
104
+ () => { const r = getPageRange(25, 10, 2); if (r && r.start === 10 && r.end === 20) passed++; else failed++; },
105
+ () => { const r = getPageRange(25, 10, 3); if (r && r.start === 20 && r.end === 25) passed++; else failed++; },
106
+ () => { const r = getPageRange(30, 10, 3); if (r && r.start === 20 && r.end === 30) passed++; else failed++; },
107
+ ];
108
+ tests.forEach(t => t());
109
+ return { passed, failed };
110
+ }
111
+ const { passed, failed } = runTests();
112
+ console.log(`Passed: ${passed}, Failed: ${failed}`);
113
+ if (failed === 0) console.log('All tests passed');
114
+ process.exit(failed > 0 ? 1 : 0);
115
+ language: javascript
116
+ readonly: true
117
+ task: "Run node pagination.test.js. One or more tests fail because the last page's end index is wrong. Fix getPageRange so all tests pass. The end index should be the exclusive upper bound (e.g. for items 20-24, start=20, end=25)."
118
+ validations:
119
+ - label: "All tests passed"
120
+ check: output-contains
121
+ pattern: "All tests passed"
122
+ hints:
123
+ - "For the last page, we might have fewer items than itemsPerPage. What should end be?"
124
+ - "end should be Math.min(start + itemsPerPage, totalItems) so we never exceed totalItems."
125
+ - "Page 3 of 25 items with 10 per page: start=20, end should be 25, not 30."
126
+ agent_prompts:
127
+ on_start: "When you have 25 items and 10 per page, how many pages are there? What's the start and end index for the last page?"
@@ -0,0 +1,68 @@
1
+ # Demo Test — All System Elements
2
+
3
+ This module exists to exercise every content and visual element in Socrates. It is intentionally short — one or two examples of each element type — so it can be used for manual walkthroughs or automated regression tests.
4
+
5
+ ## Section 1: Basic Markdown
6
+
7
+ Plain text with **bold**, *italic*, `inline code`, and [a link](https://example.com).
8
+
9
+ - Bullet list item one
10
+ - Bullet list item two
11
+ - Bullet list item three
12
+
13
+ 1. Numbered item one
14
+ 2. Numbered item two
15
+ 3. Numbered item three
16
+
17
+ > A blockquote to test rendering.
18
+
19
+ ## Section 2: Code Blocks
20
+
21
+ ```bash
22
+ echo "Hello from a bash code block"
23
+ ```
24
+
25
+ ```javascript
26
+ function greet(name) {
27
+ return `Hello, ${name}!`;
28
+ }
29
+ ```
30
+
31
+ ## Section 3: Tables
32
+
33
+ | Element | Type | Tested |
34
+ |---------|------|--------|
35
+ | Mermaid diagram | Visual | Yes |
36
+ | Timed-choice quiz | Interactive | Yes |
37
+ | Terminal practice | Interactive | Yes |
38
+ | Command sprint game | Interactive | Yes |
39
+
40
+ ## Section 4: Mermaid Diagrams
41
+
42
+ ```mermaid
43
+ flowchart LR
44
+ A[Content] -->|read| B[Walkthrough]
45
+ B -->|practice| C[Exercises]
46
+ C -->|test| D[Quiz]
47
+ D -->|play| E[Games]
48
+ ```
49
+
50
+ ```mermaid
51
+ sequenceDiagram
52
+ participant U as User
53
+ participant T as Teacher
54
+ participant C as Canvas
55
+ U->>T: Start lesson
56
+ T->>C: Show diagram
57
+ C-->>U: Visual display
58
+ U->>T: Answer question
59
+ T->>U: Socratic feedback
60
+ ```
61
+
62
+ ## Section 5: Key Concepts
63
+
64
+ **Progressive Enhancement**: Socrates works in three tiers — full (extension + canvas), canvas-only (SSE + REST), and terminal-only (CLI). Every teaching interaction must work in terminal mode at minimum.
65
+
66
+ **Socratic Method**: The teacher asks, never tells. Users discover answers through guided questions and hands-on practice.
67
+
68
+ **Gamification**: XP, belts, and progress tracking keep learners motivated. Belts range from White (0 XP) to Black (3000 XP).
@@ -0,0 +1,28 @@
1
+ # Demo Test Exercises
2
+
3
+ ## Exercise 1: Create a File
4
+
5
+ **Task:** Create a file called `test-output.txt` containing the text "Socrates works!" using a single terminal command.
6
+
7
+ **Validation:**
8
+ - [ ] File `test-output.txt` exists
9
+ - [ ] File contains the exact text "Socrates works!"
10
+
11
+ **Hints:**
12
+ 1. Use `echo` with output redirection (`>`)
13
+ 2. `echo "Socrates works!" > test-output.txt`
14
+
15
+ ---
16
+
17
+ ## Exercise 2: Explore a Module
18
+
19
+ **Task:** List all files in the `demo-test` module directory and identify which file types are present.
20
+
21
+ **Validation:**
22
+ - [ ] User can list: module.yaml, content.md, walkthrough.md, quiz.md, exercises.md, quick-ref.md, resources.md, game.yaml, workshop.yaml
23
+ - [ ] User identifies the purpose of at least 3 file types
24
+
25
+ **Hints:**
26
+ 1. Use `ls` to list directory contents
27
+ 2. Each file serves a specific role: metadata, content, interactive elements
28
+ 3. The module.yaml is the entry point that describes the module
@@ -0,0 +1,171 @@
1
+ games:
2
+ - type: command-sprint
3
+ title: "Socrates Command Sprint"
4
+ challenges:
5
+ - prompt: "List all files in the current directory (including hidden)."
6
+ answer: "ls -la"
7
+ alternates: ["ls -al", "ls -a -l"]
8
+ timeLimit: 15
9
+ - prompt: "Create a directory called 'test-dir'."
10
+ answer: "mkdir test-dir"
11
+ alternates: ["mkdir -p test-dir"]
12
+ timeLimit: 12
13
+ - prompt: "Write 'hello' to a file called output.txt."
14
+ answer: "echo hello > output.txt"
15
+ alternates: ["echo 'hello' > output.txt", "printf 'hello' > output.txt"]
16
+ timeLimit: 18
17
+
18
+ - type: speed-round
19
+ title: "Socrates Speed Round"
20
+ rounds:
21
+ - question: "Which tier always works, even without a browser?"
22
+ options:
23
+ - "Full tier"
24
+ - "Canvas tier"
25
+ - "Terminal tier"
26
+ answer: 2
27
+ timeLimit: 12
28
+ - question: "What method does Socrates use for teaching?"
29
+ options:
30
+ - "Lecture-based"
31
+ - "Socratic (question-based)"
32
+ - "Video-only"
33
+ answer: 1
34
+ timeLimit: 12
35
+ - question: "What color is the first belt in Socrates?"
36
+ options:
37
+ - "Yellow"
38
+ - "Green"
39
+ - "White"
40
+ answer: 2
41
+ timeLimit: 10
42
+
43
+ - type: bug-hunt
44
+ title: "Spot the Bug"
45
+ snippets:
46
+ - code: |
47
+ function add(a, b) {
48
+ return a - b;
49
+ }
50
+ console.log(add(2, 3)); // Expected: 5
51
+ bugLine: 2
52
+ explanation: "The function is named 'add' but uses subtraction (-) instead of addition (+)."
53
+ hint: "Look at the operator on line 2."
54
+ - code: |
55
+ const items = [1, 2, 3];
56
+ for (let i = 0; i <= items.length; i++) {
57
+ console.log(items[i]);
58
+ }
59
+ bugLine: 2
60
+ explanation: "Off-by-one error: <= should be <. When i equals items.length, items[i] is undefined."
61
+ hint: "Array indices go from 0 to length - 1."
62
+ - code: |
63
+ async function fetchUser(id) {
64
+ const res = fetch(`/api/users/${id}`);
65
+ return res.json();
66
+ }
67
+ bugLine: 2
68
+ explanation: "Missing 'await' before fetch(). Without it, res is a Promise, not a Response, so res.json() will fail."
69
+ hint: "This is an async function — are all async calls awaited?"
70
+
71
+ - type: classify
72
+ title: "Element Sorter"
73
+ categories:
74
+ - name: Interactive
75
+ color: "#58a6ff"
76
+ - name: Visual
77
+ color: "#3fb950"
78
+ - name: Content
79
+ color: "#f0883e"
80
+ items:
81
+ - text: "Quiz"
82
+ category: "Interactive"
83
+ - text: "Terminal practice"
84
+ category: "Interactive"
85
+ - text: "Game"
86
+ category: "Interactive"
87
+ - text: "Mermaid diagram"
88
+ category: "Visual"
89
+ - text: "Celebration animation"
90
+ category: "Visual"
91
+ - text: "Progress bar"
92
+ category: "Visual"
93
+ - text: "Markdown text"
94
+ category: "Content"
95
+ - text: "Quick reference"
96
+ category: "Content"
97
+ - text: "Resource links"
98
+ category: "Content"
99
+
100
+ - type: scenario
101
+ title: "The Module Author"
102
+ startHealth: 3
103
+ steps:
104
+ - id: start
105
+ situation: "You're creating a new learning module for Socrates. You have a topic in mind. What do you create first?"
106
+ choices:
107
+ - text: "Start with module.yaml to define metadata, XP, and triggers."
108
+ consequence: "Good instinct. The metadata file is the entry point that defines everything about the module."
109
+ health: 1
110
+ next: content
111
+ - text: "Jump straight into writing quiz questions."
112
+ consequence: "Quizzes are important, but without content there's nothing to quiz on."
113
+ health: -1
114
+ next: content
115
+ - text: "Write the content.md reference material first."
116
+ consequence: "Content is foundational, but you'll need module.yaml to register the module."
117
+ health: 0
118
+ next: yaml_later
119
+ - id: yaml_later
120
+ situation: "You've written great content but realize the module isn't recognized by the system. What's missing?"
121
+ choices:
122
+ - text: "Create module.yaml with slug, title, description, and XP config."
123
+ consequence: "Now the system can find and load your module."
124
+ health: 1
125
+ next: content
126
+ - text: "Add the module to registry.yaml directly."
127
+ consequence: "The registry references modules, but each module needs its own module.yaml first."
128
+ health: 0
129
+ next: content
130
+ - id: content
131
+ situation: "Your module.yaml and content.md are ready. What do you add next to make the module interactive?"
132
+ choices:
133
+ - text: "Add a walkthrough.md with Socratic questions and hint directives."
134
+ consequence: "The walkthrough is the heart of the teaching experience."
135
+ health: 1
136
+ next: finish
137
+ - text: "Add all six game types to game.yaml."
138
+ consequence: "Games are fun but a walkthrough should come first — it's the core teaching flow."
139
+ health: 0
140
+ next: finish
141
+ - text: "Skip interactivity — content is enough."
142
+ consequence: "Content alone is passive. Socrates is built around active learning."
143
+ health: -1
144
+ next: finish
145
+ - id: finish
146
+ situation: "Your module is taking shape. Time to finalize. What's your last step?"
147
+ choices:
148
+ - text: "Add quiz, exercises, games, quick-ref, and resources. Then test everything."
149
+ consequence: "Comprehensive and thorough. A well-rounded module with all element types."
150
+ health: 1
151
+ next: end
152
+ - text: "Ship it as-is and iterate later."
153
+ consequence: "Iterating is fine, but at least add a quiz to validate learning."
154
+ health: 0
155
+ next: end
156
+
157
+ - type: memory-match
158
+ title: "Element Pairs"
159
+ pairs:
160
+ - term: "canvas:quiz"
161
+ definition: "Interactive quiz with timed-choice, drag-order, matching"
162
+ - term: "canvas:terminal"
163
+ definition: "Practice terminal with task validation"
164
+ - term: "canvas:diagram"
165
+ definition: "Mermaid diagram visualization"
166
+ - term: "canvas:game"
167
+ definition: "Interactive game (sprint, scenario, etc.)"
168
+ - term: "canvas:celebrate"
169
+ definition: "XP award and level-up animation"
170
+ - term: "canvas:html"
171
+ definition: "Rich HTML content (images, videos, links)"
@@ -0,0 +1,41 @@
1
+ slug: demo-test
2
+ title: "Demo Test — All System Elements"
3
+ version: 1.0.0
4
+ description: "A short module that exercises every teaching element in Socrates. Used for manual and automated testing."
5
+ category: meta
6
+ tags: [demo, test, qa, all-elements]
7
+ difficulty: beginner
8
+
9
+ xp:
10
+ read: 10
11
+ walkthrough: 40
12
+ exercise: 25
13
+ quiz: 20
14
+ quiz-perfect-bonus: 10
15
+ game: 25
16
+ game-perfect-bonus: 15
17
+
18
+ time:
19
+ quick: 2
20
+ read: 5
21
+ guided: 10
22
+
23
+ prerequisites: []
24
+ related: []
25
+
26
+ triggers:
27
+ - "Run the demo test module"
28
+ - "Test all teaching elements"
29
+ - "Show me a demo of Socrates"
30
+
31
+ visuals:
32
+ diagrams: [diagram-mermaid, diagram-flow]
33
+ quiz-types: [quiz-timed-choice, quiz-drag-order, quiz-matching, quiz-fill-blank]
34
+ game-types: [speed-round, bug-hunt, classify, scenario, command-sprint, memory-match]
35
+ playground: bash
36
+ web-embeds: true
37
+ workshop: true
38
+
39
+ sources:
40
+ - url: "https://github.com/Socrates"
41
+ label: "Socrates Repository"
@@ -0,0 +1,54 @@
1
+ # Demo Test Quick Reference
2
+
3
+ ## Module File Types
4
+ | File | Purpose | Required |
5
+ |------|---------|----------|
6
+ | `module.yaml` | Metadata, XP, triggers, visuals config | Yes |
7
+ | `content.md` | Reference content (the "textbook") | Yes |
8
+ | `walkthrough.md` | Socratic guided lesson steps | No |
9
+ | `quiz.md` | Quiz questions with answers | No |
10
+ | `exercises.md` | Hands-on exercises with validation | No |
11
+ | `quick-ref.md` | Cheat sheet / command reference | No |
12
+ | `resources.md` | External links, videos, books | No |
13
+ | `game.yaml` | Interactive games | No |
14
+ | `workshop.yaml` | Workshop scenarios (editor + terminal) | No |
15
+
16
+ ## Quiz Types
17
+ | Type | Directive | Use Case |
18
+ |------|-----------|----------|
19
+ | Timed choice | *(default)* | Multiple choice A/B/C/D |
20
+ | Drag order | `<!-- VISUAL: drag-order -->` | Order items correctly |
21
+ | Matching | `<!-- VISUAL: quiz-matching -->` | Match pairs |
22
+ | Fill blank | `<!-- VISUAL: fill-blank -->` | Fill in missing text |
23
+
24
+ ## Game Types
25
+ | Type | Data | Purpose |
26
+ |------|------|---------|
27
+ | `speed-round` | `rounds` | Timed multiple choice |
28
+ | `bug-hunt` | `snippets` | Find bugs in code |
29
+ | `classify` | `categories`, `items` | Sort items into groups |
30
+ | `scenario` | `steps`, `startHealth` | Branching narrative |
31
+ | `command-sprint` | `challenges` | Type correct commands |
32
+ | `memory-match` | `pairs` | Match term/definition |
33
+
34
+ ## Walkthrough Hints
35
+ | Hint | Visual Element |
36
+ |------|---------------|
37
+ | `hint:terminal` | Practice terminal |
38
+ | `hint:diagram` | Mermaid diagram |
39
+ | `hint:buttons` | Smart buttons |
40
+ | `hint:card` | Info card |
41
+ | `hint:code` | Code snippet |
42
+ | `hint:list` | Smart list |
43
+ | `hint:steps` | Step tracker |
44
+ | `hint:progress` | Progress bar |
45
+ | `hint:embed` | Web embed |
46
+ | `hint:quiz inline` | Inline quiz |
47
+ | `hint:celebrate` | Celebration |
48
+ | `hint:video` | YouTube video |
49
+ | `hint:game` | Game offer |
50
+
51
+ ## Belt Progression
52
+ ```
53
+ White (0) → Yellow (50) → Green (150) → Blue (400) → Purple (800) → Brown (1500) → Black (3000)
54
+ ```
@@ -0,0 +1,74 @@
1
+ # Demo Test Quiz
2
+
3
+ ## Question 1
4
+
5
+ What is the Socratic method?
6
+
7
+ A) Giving students the correct answer immediately
8
+ B) Teaching through questions that guide the learner to discover answers
9
+ C) Memorizing facts through repetition
10
+ D) Watching video lectures passively
11
+
12
+ <!-- ANSWER: B -->
13
+ <!-- EXPLANATION: The Socratic method teaches by asking questions rather than providing direct answers. This forces active thinking and deeper understanding. Socrates uses this approach — the teacher asks, never tells. -->
14
+
15
+ ## Question 2
16
+
17
+ How many tiers does Socrates's progressive enhancement support?
18
+
19
+ A) 1
20
+ B) 2
21
+ C) 3
22
+ D) 4
23
+
24
+ <!-- ANSWER: C -->
25
+ <!-- EXPLANATION: Socrates has three tiers: Full (extension + canvas via WebSocket), Canvas (SSE + REST), and Terminal (CLI only). Each tier degrades gracefully — terminal always works. -->
26
+
27
+ ## Question 3
28
+
29
+ <!-- VISUAL: drag-order -->
30
+
31
+ Put these Socrates learning activities in order from passive to most interactive:
32
+
33
+ A) Playing a command-sprint game
34
+ B) Reading content
35
+ C) Answering a quiz
36
+ D) Completing a terminal exercise
37
+
38
+ <!-- ANSWER: B,C,D,A -->
39
+ <!-- EXPLANATION: Reading is passive consumption. Quizzes test recall. Terminal exercises require hands-on practice. Games add time pressure and competition, making them the most actively engaging. -->
40
+
41
+ ## Question 4
42
+
43
+ <!-- VISUAL: quiz-matching -->
44
+
45
+ Match each belt color to its minimum XP requirement:
46
+
47
+ A) White → 1) 0 XP
48
+ B) Yellow → 2) 50 XP
49
+ C) Green → 3) 150 XP
50
+ D) Blue → 4) 400 XP
51
+
52
+ <!-- ANSWER: A1,B2,C3,D4 -->
53
+ <!-- EXPLANATION: Belts progress from White (0 XP) through Yellow (50), Green (150), Blue (400), Purple (800), Brown (1500), to Black (3000 XP). -->
54
+
55
+ ## Question 5
56
+
57
+ Fill in the blank: In Socrates, all packages communicate through a shared ___0___ with JSON envelopes.
58
+
59
+ <!-- VISUAL: fill-blank -->
60
+
61
+ <!-- ANSWER: protocol -->
62
+ <!-- EXPLANATION: The shared protocol (packages/shared/src/protocol.js) defines all 18 message types and the JSON envelope format. Every package uses this protocol to communicate. -->
63
+
64
+ ## Question 6
65
+
66
+ Which of these is NOT a game type in Socrates?
67
+
68
+ A) command-sprint
69
+ B) memory-match
70
+ C) word-search
71
+ D) bug-hunt
72
+
73
+ <!-- ANSWER: C -->
74
+ <!-- EXPLANATION: Socrates supports six game types: speed-round, bug-hunt, classify, scenario, command-sprint, and memory-match. Word-search is not one of them. -->
@@ -0,0 +1,21 @@
1
+ # Demo Test — Resources
2
+
3
+ ## Project Docs
4
+
5
+ - [Socrates SPEC.md](../../SPEC.md) — Single source of truth for the system.
6
+ - [Architecture](../../docs/architecture.md) — System diagrams and data flow.
7
+
8
+ ## Socratic Method
9
+
10
+ - [Stanford Encyclopedia — Socrates](https://plato.stanford.edu/entries/socrates/) — Philosophical background on Socratic dialogue.
11
+ - [What is the Socratic Method?](https://www.youtube.com/watch?v=N6CAzYzrFiE) — Short video explainer.
12
+
13
+ ## Gamification in Education
14
+
15
+ - [Gamification in Education: A Systematic Review](https://www.sciencedirect.com/science/article/pii/S0360131514002000) — Research on gamification effectiveness.
16
+ - [Duolingo's Gamification Strategy](https://blog.duolingo.com/) — Real-world example of gamified learning.
17
+
18
+ ## Tools
19
+
20
+ - [Mermaid Live Editor](https://mermaid.live/) — Test and preview Mermaid diagrams.
21
+ - [Vitest](https://vitest.dev/) — The test framework used by Socrates.