Commit 3327f5b
committed
feat: Language adapter architecture (Phase 0-2)
- Phase 0: Language context management & simplified slug format
* Add language state in internal.py (get/set_current_language)
* Pass language to subprocesses via CROSS_PROCESS_ATTRIBUTES
* Simplify parse_slug() to 2-part format only (course/stage)
* Add 36 tests covering internal & slug parsing (82 total, 100% pass)
- Phase 1: Adapter pattern for multi-language support
* base.py: LanguageAdapter ABC with compile/run/exists
* conventions.py: Naming rules for 8 languages (C, C++, Java, Python, Go, Rust, JS, TS)
* compiled.py: Concrete adapters for compiled & interpreted languages
* factory.py: create_adapter() with auto-detection
* Add get_adapter() convenience function in check/__init__.py
* Add 41 adapter tests (123 total, 100% pass)
- Phase 2: Hello check migration (unified multi-language)
* Migrate cs50/hello to use adapters (22 lines vs 810 lines = 97.3% reduction)
* Support C, Java, Python with single check script
* Add integration tests & student code samples
* All 129 tests passing (126 unit + 3 integration + 61 subtests)
Key improvements:
- Code reduction: 810 lines → 22 lines (97.3% less code)
- Zero configuration for 80% use cases (convention over configuration)
- Unified API: get_adapter().require_exists(), compile(), run().stdout().exit()
- Extensible: Easy to add new languages via conventions1 parent ae3cba6 commit 3327f5b
File tree
27 files changed
+5027
-56
lines changed- bootcs
- check
- adapters
- docs
- tests
- integration
- hello-c
- hello.dSYM/Contents
- Resources
- DWARF
- Relocations/aarch64
- hello-java
- hello-python
- unit
27 files changed
+5027
-56
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | | - | |
111 | | - | |
112 | | - | |
| 110 | + | |
| 111 | + | |
113 | 112 | | |
114 | 113 | | |
115 | | - | |
116 | | - | |
| 114 | + | |
117 | 115 | | |
118 | 116 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
128 | 122 | | |
129 | | - | |
| 123 | + | |
| 124 | + | |
130 | 125 | | |
131 | 126 | | |
132 | 127 | | |
| |||
178 | 173 | | |
179 | 174 | | |
180 | 175 | | |
181 | | - | |
182 | | - | |
| 176 | + | |
| 177 | + | |
183 | 178 | | |
184 | | - | |
| 179 | + | |
185 | 180 | | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
| 181 | + | |
190 | 182 | | |
191 | 183 | | |
192 | 184 | | |
193 | | - | |
| 185 | + | |
194 | 186 | | |
195 | 187 | | |
196 | 188 | | |
| |||
239 | 231 | | |
240 | 232 | | |
241 | 233 | | |
242 | | - | |
| 234 | + | |
243 | 235 | | |
244 | 236 | | |
245 | 237 | | |
| |||
341 | 333 | | |
342 | 334 | | |
343 | 335 | | |
344 | | - | |
345 | | - | |
346 | | - | |
| 336 | + | |
| 337 | + | |
347 | 338 | | |
348 | 339 | | |
349 | 340 | | |
350 | 341 | | |
351 | 342 | | |
352 | 343 | | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
| 344 | + | |
| 345 | + | |
359 | 346 | | |
360 | 347 | | |
361 | 348 | | |
362 | 349 | | |
363 | | - | |
| 350 | + | |
364 | 351 | | |
365 | | - | |
| 352 | + | |
366 | 353 | | |
367 | 354 | | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
| 355 | + | |
373 | 356 | | |
374 | | - | |
| 357 | + | |
375 | 358 | | |
376 | 359 | | |
377 | | - | |
| 360 | + | |
378 | 361 | | |
379 | 362 | | |
380 | 363 | | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | 364 | | |
386 | 365 | | |
387 | 366 | | |
| |||
531 | 510 | | |
532 | 511 | | |
533 | 512 | | |
534 | | - | |
535 | | - | |
| 513 | + | |
| 514 | + | |
536 | 515 | | |
537 | | - | |
| 516 | + | |
538 | 517 | | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
| 518 | + | |
543 | 519 | | |
544 | 520 | | |
545 | 521 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
35 | 54 | | |
36 | 55 | | |
37 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
0 commit comments