@thanh01.pmt/curriculum-kit 1.4.42 → 1.4.44

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.
@@ -4,15 +4,17 @@ var ai = require('ai');
4
4
  var google = require('@ai-sdk/google');
5
5
  var openai = require('@ai-sdk/openai');
6
6
  var deepseek = require('@ai-sdk/deepseek');
7
- var fs = require('fs');
7
+ var fs2 = require('fs');
8
8
  var path = require('path');
9
9
  var zod = require('zod');
10
+ var url = require('url');
10
11
  var pLimit = require('p-limit');
11
12
  var fsPromises = require('fs/promises');
12
13
 
14
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
13
15
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
16
 
15
- var fs__default = /*#__PURE__*/_interopDefault(fs);
17
+ var fs2__default = /*#__PURE__*/_interopDefault(fs2);
16
18
  var path__default = /*#__PURE__*/_interopDefault(path);
17
19
  var pLimit__default = /*#__PURE__*/_interopDefault(pLimit);
18
20
  var fsPromises__default = /*#__PURE__*/_interopDefault(fsPromises);
@@ -603,8 +605,8 @@ function resolveApiKey(keyName, explicitKey) {
603
605
  path__default.default.resolve(currentDir, "../..", ".env")
604
606
  ];
605
607
  for (const envPath of envPaths) {
606
- if (fs__default.default.existsSync(envPath)) {
607
- const content = fs__default.default.readFileSync(envPath, "utf-8");
608
+ if (fs2__default.default.existsSync(envPath)) {
609
+ const content = fs2__default.default.readFileSync(envPath, "utf-8");
608
610
  for (const line of content.split("\n")) {
609
611
  const trimmed = line.trim();
610
612
  if (trimmed && !trimmed.startsWith("#") && trimmed.startsWith(keyName + "=")) {
@@ -2482,467 +2484,61 @@ zod.z.object({
2482
2484
  }),
2483
2485
  phases: zod.z.array(PhaseInputSchema).default([])
2484
2486
  });
2485
-
2486
- // src/templates/lessonTemplate.ts
2487
- var LESSON_PLAN_TEMPLATE = `
2488
- ---
2489
- id: "{{ID}}"
2490
- title: "{{TITLE}}"
2491
- type: "LESSON_5E"
2492
- created_by: "Curriculum OS Builder"
2493
- phase: "{{PHASE}}"
2494
- deliverable: "P3-T1"
2495
- version: "{{VERSION}}"
2496
- date: "{{DATE}}"
2497
- prerequisite: []
2498
- template_contract: "lesson-plan-v2"
2499
- template_required_sections:
2500
- - "A. Lesson Design Plan"
2501
- - "Learning Objectives & Evidence"
2502
- - "Activity Sequence"
2503
- - "Resource Map"
2504
- - "Assessment Map"
2505
- - "Artifact Contract"
2506
- - "B. Lesson Flow"
2507
- ---
2508
- <!-- INJECT_BODY -->
2509
-
2510
- # LESSON [{{LESSON_ID}}]: {{TITLE}} (5E Model)
2511
-
2512
- ## [REQUIRED] A. Lesson Design Plan
2513
-
2514
- ### 1. Learning Objectives & Evidence
2515
- - **Estimated Duration:** {{DURATION}}
2516
- - **Materials & Equipment:** {{MATERIALS_SUMMARY}}
2517
- - **Keywords / Core Concepts:** {{KEYWORDS}}
2518
-
2519
- | LO | Objective (Bloom's) | Student Evidence | Success Criteria |
2520
- |---|---|---|---|
2521
- {{LEARNING_OBJECTIVES_TABLE_ROWS}}
2522
-
2523
- ### 2. Activity Sequence
2524
- > This is the canonical activity contract. Satellite artifacts must expand this sequence and must not invent a different one.
2525
-
2526
- | Seq | 5E Phase | Activity Type | Actor | Purpose | Student Action | Teacher Move | Output/Evidence | LO | Time | Artifact Contract |
2527
- |---|---|---|---|---|---|---|---|---|---|---|
2528
- {{ACTIVITY_SEQUENCE_TABLE_ROWS}}
2529
-
2530
- ### 3. Resource Map
2531
- | Resource | Used In Activity | Purpose | Owner Artifact |
2532
- |---|---|---|---|
2533
- {{RESOURCE_MAP_TABLE_ROWS}}
2534
-
2535
- ### 4. Assessment Map
2536
- | Evidence | Assessed By | Criteria | Follow-up If Missing |
2537
- |---|---|---|---|
2538
- {{ASSESSMENT_MAP_TABLE_ROWS}}
2539
-
2540
- ### 5. Artifact Contract
2541
- - **ACT must expand:** {{ACT_CONTRACT}}
2542
- - **GUIDE must support:** {{GUIDE_CONTRACT}}
2543
- - **SLIDE must visualize:** {{SLIDE_CONTRACT}}
2544
- - **HANDOUT must provide:** {{HANDOUT_CONTRACT}}
2545
- - **WKS must practice:** {{WKS_CONTRACT}}
2546
- - **QUIZ must assess:** {{QUIZ_CONTRACT}}
2547
- - **EXT must extend:** {{EXT_CONTRACT}}
2548
-
2549
- ---
2550
-
2551
- ## [REQUIRED] B. Lesson Flow
2552
-
2553
- ### 1. ENGAGE \u2014 {{ENGAGE_DURATION}} mins
2554
- - **Hook Scenario:** {{HOOK_SCENARIO}}
2555
- - **Open Question:** {{HOOK_OPEN_QUESTION}}
2556
- - **Transition:** {{HOOK_TRANSITION}}
2557
-
2558
- ### 2. EXPLORE \u2014 {{EXPLORE_DURATION}} mins
2559
- - **Activity Reference:** {{EXPLORE_ACTIVITY_REF}}
2560
- - **Student Discovery:** {{EXPLORE_STUDENT_DISCOVERY}}
2561
-
2562
- ### 3. EXPLAIN \u2014 {{EXPLAIN_DURATION}} mins
2563
- - **Definitions:**
2564
- {{EXPLAIN_DEFINITIONS}}
2565
- - **Visual Illustration (REQUIRED):**
2566
- {{EXPLAIN_VISUAL_ILLUSTRATION}}
2567
-
2568
- ### 4. ELABORATE \u2014 {{ELABORATE_DURATION}} mins
2569
- - **Tiered Scaffolding:**
2570
- - \u{1F949} **Bronze:** {{DIFFERENTIATION_BRONZE}}
2571
- - \u{1F948} **Silver:** {{DIFFERENTIATION_SILVER}}
2572
- - \u{1F947} **Gold:** {{DIFFERENTIATION_GOLD}}
2573
-
2574
- > **ACT Contract**: Detailed operational instructions must expand the Activity Sequence above and must not change the planned evidence target.
2575
-
2576
- ### 5. EVALUATE \u2014 {{EVALUATE_DURATION}} mins
2577
- - **Exit Ticket:** {{EXIT_TICKET_CONTENT}}
2578
- - **Closing:** {{CLOSING_REMARKS}}
2579
-
2580
- > **QUIZ Contract**: Detailed assessment criteria and rubrics must assess the evidence and success criteria defined in the Lesson Design Plan.
2581
-
2582
- ---
2583
-
2584
- ## [OPTIONAL] Teacher Notes
2585
- - **Common Pitfalls:**
2586
- {{COMMON_PITFALLS}}
2587
- - **Troubleshooting:**
2588
- {{TROUBLESHOOTING_ROWS}}
2589
-
2590
- ---
2591
-
2592
- ## [REQUIRED] Artifact Linkage (Master Index)
2593
- > List all satellite files used in this lesson.
2594
-
2595
- | Artifact File | Role in the Classroom | When to Use |
2596
- |---|---|---|
2597
- | \`GUIDE_{{LESSON_ID}}.md\` | Detailed Teaching Script | Teacher preparation |
2598
- | \`SLIDE_{{LESSON_ID}}.md\` | Presentation Content | Throughout the session |
2599
- | \`HANDOUT_{{LESSON_ID}}.md\` | Theory Summary for Students | During EXPLAIN phase |
2600
- | \`ACT_{{LESSON_ID}}.md\` | Detailed Learning Activity Operations | During EXPLORE / ELABORATE / checkpoint phases |
2601
- | \`WKS_{{LESSON_ID}}.md\` | Individual Worksheet | Wrap-up or Homework |
2602
- | \`QUIZ_{{LESSON_ID}}.md\` | Assessment Rubric | During EVALUATE phase |
2603
- | \`EXT_{{LESSON_ID}}.md\` | Enrichment Materials | For "Gold" students |
2604
- `.trim();
2605
-
2606
- // src/templates/actTemplate.ts
2607
- var ACT_TEMPLATE = `
2608
- ---
2609
- id: "{{ID}}"
2610
- title: "{{TITLE}}"
2611
- type: "ACT"
2612
- created_by: "Curriculum OS Builder"
2613
- phase: "{{PHASE}}"
2614
- deliverable: "P3-T2"
2615
- version: "{{VERSION}}"
2616
- date: "{{DATE}}"
2617
- template_contract: "artifact-template-v1"
2618
- template_required_sections:
2619
- - "Computational Thinking Focus"
2620
- - "Materials & Setup"
2621
- - "Constraints & Safety"
2622
- - "Active Learning Workflow"
2623
- - "3-Tier Differentiation"
2624
- - "Reflection"
2625
- ---
2626
- <!-- INJECT_BODY -->
2627
-
2628
- # INQUIRY-BASED ACTIVITY: {{TITLE}}
2629
- _Milestone: {{MILESTONE_ID}} | Module: {{MODULE_NAME}} | Lesson: {{LESSON_ID}}_
2630
-
2631
- ## [REQUIRED] Computational Thinking Focus
2632
- - **Problem Statement (Real-world Scenario):** {{PROBLEM_STATEMENT}}
2633
- - **Decomposition:**
2634
- {{DECOMPOSITION_STEPS}}
2635
- - **Algorithm Design:** {{ALGORITHM_DESIGN}}
2636
-
2637
- ## [REQUIRED] Materials & Setup
2638
- - **Reference Material:** Students should use the **HANDOUT** for this lesson as their primary technical reference (lifeline).
2639
- - **Hardware/Software:**
2640
- <!-- [HARDWARE_BOM] -->
2641
- {{HARDWARE_ITEMS}}
2642
- <!-- [/HARDWARE_BOM] -->
2643
- - **Software:** {{SOFTWARE_ITEMS}}
2644
- - **Consumables:** {{CONSUMABLES}}
2645
- - **Other Resources:** {{OTHER_RESOURCES}}
2646
-
2647
- ## [REQUIRED] Constraints & Safety
2648
- - \u26A0\uFE0F **Technical/Safety:** {{SAFETY_WARNING}}
2649
- - \u{1F4A1} **Design Constraint:** {{DESIGN_CONSTRAINT}}
2650
-
2651
- ## [REQUIRED] Active Learning Workflow
2652
-
2653
- ### Phase 1: Planning & Design \u2014 {{PHASE1_DURATION}} mins
2654
- - **Student Task:** Hand-draw (or draft in words) the algorithm flowchart or connection architecture before touching the computer/devices.
2655
- - **Teacher Action:** Walk around to check the logic of each group. Ask inquiry questions:
2656
- {{PHASE1_INQUIRY_QUESTIONS}}
2657
-
2658
- ### Phase 2: Implementation & Discovery \u2014 {{PHASE2_DURATION}} mins
2659
- - **Student Task:** Apply the knowledge from the **HANDOUT** to realize the plan designed in Phase 1. Encourage self-inquiry and documentation lookup.
2660
- - **Teacher Action:** Avoid "hand-holding." Only intervene if a group has been stuck for more than 5 minutes.
2661
- {{PHASE2_GUIDANCE_BLOCK}}
2662
-
2663
- ### Phase 3: Debugging & Testing \u2014 {{PHASE3_DURATION}} mins
2664
- - **Testing:** Students run their system.
2665
- - **Error Analysis:** Ask students to record any error codes or unexpected behaviors and compare them with the Troubleshooting table in the Handout.
2666
- {{PHASE3_TESTING_STEPS}}
2667
-
2668
- ## [REQUIRED] 3-Tier Differentiation
2669
- > MUST design tasks in 3 tiers to support diverse learner groups. Bronze is the minimum requirement for all students.
2670
- - \u{1F949} **Bronze (Foundational):** {{DIFFERENTIATION_BRONZE}}
2671
- - \u{1F948} **Silver (Application):** {{DIFFERENTIATION_SILVER}}
2672
- - \u{1F947} **Gold (Enrichment/Creative):** {{DIFFERENTIATION_GOLD}}
2673
-
2674
- ## [REQUIRED] Reflection
2675
- - **Discussion Question:** {{REFLECTION_QUESTION}}
2676
- `.trim();
2677
-
2678
- // src/templates/codeLabTemplate.ts
2679
- var CODE_LAB_TEMPLATE = `
2680
- ---
2681
- id: "{{ID}}"
2682
- title: "{{TITLE}}"
2683
- type: "LAB"
2684
- created_by: "Curriculum OS Builder"
2685
- phase: "{{PHASE}}"
2686
- deliverable: "P3-T2"
2687
- version: "{{VERSION}}"
2688
- date: "{{DATE}}"
2689
- ---
2690
- <!-- INJECT_BODY -->
2691
-
2692
- # \u{1F468}\u200D\u{1F4BB} CODE LAB: {{TITLE}}
2693
- _Milestone: {{MILESTONE_ID}} | Tech Stack: {{TECH_STACK}}_
2694
-
2695
- ## \u{1F3AF} Overview
2696
- This lab focuses on the practical implementation of core technical concepts, bridging theory into working, robust, and testable code.
2697
-
2698
- ## \u{1F6E0}\uFE0F Environment & Setup
2699
- - **Language / Framework:** {{LANGUAGE_FRAMEWORK}}
2700
- - **IDE / Editor:** {{IDE_EDITOR}}
2701
- - **Required Libraries:** {{REQUIRED_LIBRARIES}}
2702
- - **Hardware / Connection Setup:** {{HARDWARE_ENV_CONNECTION}}
2703
-
2704
- ## \u{1F4DD} Lab Tasks (3-Tier Differentiation)
2705
-
2706
- ### \u{1F949} Bronze (Foundational) \u2014 {{BRONZE_MINS}} mins
2707
- **Objective:** {{BRONZE_OBJECTIVE}}
2708
- - **Task:** {{BRONZE_TASK}}
2709
- - **Requirement:** {{BRONZE_REQUIREMENT}}
2710
-
2711
- ### \u{1F948} Silver (Application) \u2014 {{SILVER_MINS}} mins
2712
- **Objective:** {{SILVER_OBJECTIVE}}
2713
- - **Task:** {{SILVER_TASK}}
2714
- - **Requirement:** {{SILVER_REQUIREMENT}}
2715
-
2716
- ### \u{1F947} Gold (Enrichment/Creative) \u2014 {{GOLD_MINS}} mins
2717
- **Objective:** {{GOLD_OBJECTIVE}}
2718
- - **Task:** {{GOLD_TASK}}
2719
- - **Requirement:** {{GOLD_REQUIREMENT}}
2720
-
2721
- ## \u{1F4BB} Technical Reference ([SME_MANDATE])
2722
- <!-- [SME_MANDATE] -->
2723
- > Any code provided in this section is verified for syntax accuracy and runtime execution.
2724
-
2725
- ### Starter Code Template
2726
- \`\`\`{{CODE_LANGUAGE}}
2727
- {{STARTER_CODE}}
2728
- \`\`\`
2729
-
2730
- ### Solution Code
2731
- \`\`\`{{CODE_LANGUAGE}}
2732
- {{SOLUTION_CODE}}
2733
- \`\`\`
2734
- <!-- [/SME_MANDATE] -->
2735
-
2736
- ## \u{1F50D} Troubleshooting & Debugging Matrix
2737
- | Issue | Potential Cause | Solution |
2738
- | :--- | :--- | :--- |
2739
- {{TROUBLESHOOTING_ROWS}}
2740
-
2741
- ## \u{1F3C1} Submission & Verification Checklist
2742
- {{CHECKLIST_ITEMS}}
2743
- `.trim();
2744
-
2745
- // src/templates/quizTemplate.ts
2746
- var QUIZ_TEMPLATE = `
2747
- ---
2748
- id: "{{ID}}"
2749
- title: "{{TITLE}}"
2750
- type: "QUIZ"
2751
- language: "{{LANGUAGE}}"
2752
- total_questions: {{TOTAL_QUESTIONS}}
2753
- passing_score_pct: {{PASSING_SCORE_PCT}}
2754
- ---
2755
-
2756
- # \u{1F9E0} Diagnostic & Active Recall Quiz: {{TITLE}}
2757
-
2758
- > \u23F1\uFE0F **Recommended Time:** ~10-15 mins
2759
- > \u{1F3AF} **Passing Score:** {{PASSING_SCORE_PCT}}%
2760
- > \u{1F4A1} **Purpose:** Test your conceptual understanding, catch hidden misconceptions, and evaluate architectural trade-offs.
2761
-
2762
- ---
2763
-
2764
- {{QUESTIONS_SECTION}}
2765
-
2766
- ---
2767
-
2768
- ## \u{1F511} Comprehensive Answer Key & Deep Explanation (Expand after completing)
2769
- <details>
2770
- <summary><b>\u{1F449} Click to View Full Explanations & Common Pitfall Analysis</b></summary>
2771
-
2772
- {{ANSWER_KEY_SECTION}}
2773
- </details>
2774
- `.trim();
2775
-
2776
- // src/templates/selfLabTemplate.ts
2777
- var SELF_LAB_TEMPLATE = `
2778
- ---
2779
- id: "{{ID}}"
2780
- title: "{{TITLE}}"
2781
- type: "SELF_LAB"
2782
- language: "{{LANGUAGE}}"
2783
- difficulty: "{{DIFFICULTY}}"
2784
- estimated_minutes: {{ESTIMATED_MINUTES}}
2785
- tech_stack: {{TECH_STACK}}
2786
- ---
2787
-
2788
- # \u{1F680} Self-Paced Hands-On Lab: {{TITLE}}
2789
-
2790
- > \u23F1\uFE0F **Estimated Duration:** ~{{ESTIMATED_MINUTES}} mins
2791
- > \u{1F3AF} **Difficulty Level:** {{DIFFICULTY_UPPER}}
2792
- > \u{1F9F0} **Tech Stack:** {{TECH_STACK_STR}}
2793
- > \u{1F4A1} **Self-Learner Notice:** You are in full control of this lab. Follow the progressive challenges below. If you get stuck at any point, use the **Progressive Hints System** to get unstuck without ruining the learning experience!
2794
-
2795
- ---
2796
-
2797
- ## \u{1F4CB} Mission Briefing & Environment Setup
2798
- {{MISSION_BRIEFING}}
2799
-
2800
- ### \u{1F6EB} Preflight Checklist
2801
- {{PREFLIGHT_CHECKLIST}}
2802
-
2803
- ---
2804
-
2805
- ## \u{1F3AF} Progressive Challenges (3-Tier Differentiation)
2806
-
2807
- ### \u{1F949} Challenge 1: Foundational Core (Bronze) \u2014 ~{{BRONZE_MINS}} mins
2808
- **Objective:** {{BRONZE_OBJECTIVE}}
2809
-
2810
- #### Tasks & Implementation Details:
2811
- {{BRONZE_TASKS}}
2812
-
2813
- #### \u{1F9EA} Self-Verification Command:
2814
- \`\`\`bash
2815
- {{BRONZE_VERIFY_COMMAND}}
2816
- \`\`\`
2817
- *Expected Terminal Output:*
2818
- \`\`\`text
2819
- {{BRONZE_EXPECTED_OUTPUT}}
2820
- \`\`\`
2821
-
2822
- #### \u{1F4A1} Progressive Hints (Expand only if stuck):
2823
- <details>
2824
- <summary><b>\u{1F4A1} Hint Level 1: Conceptual Clue (H\u01B0\u1EDBng t\u01B0 duy)</b></summary>
2825
-
2826
- {{BRONZE_HINT_1}}
2827
- </details>
2828
-
2829
- <details>
2830
- <summary><b>\u{1F50D} Hint Level 2: Structural Skeleton (Khung code m\u1EABu)</b></summary>
2831
-
2832
- \`\`\`{{CODE_LANGUAGE}}
2833
- {{BRONZE_HINT_2}}
2834
- \`\`\`
2835
- </details>
2836
-
2837
- <details>
2838
- <summary><b>\u{1F6A8} Hint Level 3: Full Solution & Explanation (L\u1EDDi gi\u1EA3i tr\u1ECDn v\u1EB9n)</b></summary>
2839
-
2840
- \`\`\`{{CODE_LANGUAGE}}
2841
- {{BRONZE_HINT_3_CODE}}
2842
- \`\`\`
2843
-
2844
- **Why this solution works:**
2845
- {{BRONZE_HINT_3_EXPLANATION}}
2846
- </details>
2847
-
2848
- ---
2849
-
2850
- ### \u{1F948} Challenge 2: Logic & Error Handling (Silver) \u2014 ~{{SILVER_MINS}} mins
2851
- **Objective:** {{SILVER_OBJECTIVE}}
2852
-
2853
- #### Tasks & Implementation Details:
2854
- {{SILVER_TASKS}}
2855
-
2856
- #### \u{1F9EA} Self-Verification Command:
2857
- \`\`\`bash
2858
- {{SILVER_VERIFY_COMMAND}}
2859
- \`\`\`
2860
- *Expected Terminal Output:*
2861
- \`\`\`text
2862
- {{SILVER_EXPECTED_OUTPUT}}
2863
- \`\`\`
2864
-
2865
- #### \u{1F4A1} Progressive Hints (Expand only if stuck):
2866
- <details>
2867
- <summary><b>\u{1F4A1} Hint Level 1: Conceptual Clue (H\u01B0\u1EDBng t\u01B0 duy)</b></summary>
2868
-
2869
- {{SILVER_HINT_1}}
2870
- </details>
2871
-
2872
- <details>
2873
- <summary><b>\u{1F50D} Hint Level 2: Structural Skeleton (Khung code m\u1EABu)</b></summary>
2874
-
2875
- \`\`\`{{CODE_LANGUAGE}}
2876
- {{SILVER_HINT_2}}
2877
- \`\`\`
2878
- </details>
2879
-
2880
- <details>
2881
- <summary><b>\u{1F6A8} Hint Level 3: Full Solution & Explanation (L\u1EDDi gi\u1EA3i tr\u1ECDn v\u1EB9n)</b></summary>
2882
-
2883
- \`\`\`{{CODE_LANGUAGE}}
2884
- {{SILVER_HINT_3_CODE}}
2885
- \`\`\`
2886
-
2887
- **Why this solution works:**
2888
- {{SILVER_HINT_3_EXPLANATION}}
2889
- </details>
2890
-
2891
- ---
2892
-
2893
- ### \u{1F947} Challenge 3: Edge Cases & Optimization (Gold) \u2014 ~{{GOLD_MINS}} mins
2894
- **Objective:** {{GOLD_OBJECTIVE}}
2895
-
2896
- #### Tasks & Implementation Details:
2897
- {{GOLD_TASKS}}
2898
-
2899
- #### \u{1F9EA} Self-Verification Command:
2900
- \`\`\`bash
2901
- {{GOLD_VERIFY_COMMAND}}
2902
- \`\`\`
2903
- *Expected Terminal Output:*
2904
- \`\`\`text
2905
- {{GOLD_EXPECTED_OUTPUT}}
2906
- \`\`\`
2907
-
2908
- #### \u{1F4A1} Progressive Hints (Expand only if stuck):
2909
- <details>
2910
- <summary><b>\u{1F4A1} Hint Level 1: Conceptual Clue (H\u01B0\u1EDBng t\u01B0 duy)</b></summary>
2911
-
2912
- {{GOLD_HINT_1}}
2913
- </details>
2914
-
2915
- <details>
2916
- <summary><b>\u{1F50D} Hint Level 2: Structural Skeleton (Khung code m\u1EABu)</b></summary>
2917
-
2918
- \`\`\`{{CODE_LANGUAGE}}
2919
- {{GOLD_HINT_2}}
2920
- \`\`\`
2921
- </details>
2922
-
2923
- <details>
2924
- <summary><b>\u{1F6A8} Hint Level 3: Full Solution & Explanation (L\u1EDDi gi\u1EA3i tr\u1ECDn v\u1EB9n)</b></summary>
2925
-
2926
- \`\`\`{{CODE_LANGUAGE}}
2927
- {{GOLD_HINT_3_CODE}}
2928
- \`\`\`
2929
-
2930
- **Why this solution works:**
2931
- {{GOLD_HINT_3_EXPLANATION}}
2932
- </details>
2933
-
2934
- ---
2935
-
2936
- ## \u{1F50D} Self-Learner Troubleshooting Matrix
2937
- | Symptom / Error Message | Root Cause | Exact Fix |
2938
- | :--- | :--- | :--- |
2939
- {{TROUBLESHOOTING_ROWS}}
2940
-
2941
- ---
2942
-
2943
- ## \u{1F3C1} Final Lab Submission & Mastery Checklist
2944
- {{FINAL_CHECKLIST}}
2945
- `.trim();
2487
+ function stripTemplateFrontmatter(raw) {
2488
+ let body = raw;
2489
+ if (body.startsWith("---")) {
2490
+ const end = body.indexOf("\n---", 3);
2491
+ if (end !== -1) body = body.slice(end + 4);
2492
+ }
2493
+ return body.split("\n").filter((l) => l.trim() !== "<!-- INJECT_BODY -->").join("\n").replace(/^\s*\n/, "").trimEnd();
2494
+ }
2495
+ var KIT_TEMPLATE_FALLBACK_DIRS = [
2496
+ // Packaged with the npm bundle (dist/templates) — resolves from node_modules.
2497
+ "templates",
2498
+ // Repo checkout layouts.
2499
+ "docs/refs/templates"
2500
+ ];
2501
+ var _moduleDir = (() => {
2502
+ try {
2503
+ if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)) }) !== "undefined" && typeof (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)) === "string") {
2504
+ return path__default.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
2505
+ }
2506
+ } catch {
2507
+ }
2508
+ return typeof __dirname !== "undefined" ? __dirname : process.cwd();
2509
+ })();
2510
+ function candidateDirs(explicitDir) {
2511
+ const dirs = [];
2512
+ if (process.env.CURRICULUM_TEMPLATES_DIR) dirs.push(process.env.CURRICULUM_TEMPLATES_DIR);
2513
+ dirs.push(path__default.default.resolve(process.cwd(), "_templates"));
2514
+ for (const rel of KIT_TEMPLATE_FALLBACK_DIRS) {
2515
+ dirs.push(path__default.default.resolve(_moduleDir, rel));
2516
+ dirs.push(path__default.default.resolve(process.cwd(), rel));
2517
+ dirs.push(path__default.default.resolve(process.cwd(), "packages/curriculum-kit", rel));
2518
+ }
2519
+ return dirs;
2520
+ }
2521
+ function findTemplatePath(templateName, explicitDir) {
2522
+ for (const dir of candidateDirs()) {
2523
+ const p = path__default.default.join(dir, templateName);
2524
+ if (!fs2__default.default.existsSync(p)) continue;
2525
+ try {
2526
+ fs2__default.default.accessSync(p, fs2__default.default.constants.R_OK);
2527
+ return p;
2528
+ } catch {
2529
+ }
2530
+ }
2531
+ return null;
2532
+ }
2533
+ function loadAuthoringTemplate(templateName, templatesDir) {
2534
+ const p = findTemplatePath(templateName);
2535
+ if (!p) return "";
2536
+ try {
2537
+ return stripTemplateFrontmatter(fs2__default.default.readFileSync(p, "utf-8"));
2538
+ } catch {
2539
+ return "";
2540
+ }
2541
+ }
2946
2542
 
2947
2543
  // src/ai/prompts/lessonMasterPrompt.ts
2948
2544
  function buildLessonMasterPrompt(input) {
@@ -2996,7 +2592,7 @@ Build a deep, rigorous, and highly pedagogical Master Lesson Plan (LESSON) that
2996
2592
  # MANDATORY TEMPLATE STRUCTURE
2997
2593
  You MUST generate structured data that will render directly into this exact Markdown template:
2998
2594
  ---
2999
- ${LESSON_PLAN_TEMPLATE}
2595
+ ${loadAuthoringTemplate("LESSON_5E_template.md") ?? "[TEMPLATE FILE NOT FOUND: LESSON_5E_template.md]"}
3000
2596
  ---
3001
2597
 
3002
2598
  # INPUT PARAMETERS
@@ -3074,7 +2670,7 @@ Transform the exact pedagogical flow and activities from the Master Lesson Plan
3074
2670
  # MANDATORY TEMPLATE STRUCTURE
3075
2671
  You MUST generate data aligned with this Markdown template:
3076
2672
  ---
3077
- ${ACT_TEMPLATE}
2673
+ ${loadAuthoringTemplate("ACT_template.md") ?? "[TEMPLATE FILE NOT FOUND: ACT_template.md]"}
3078
2674
  ---
3079
2675
 
3080
2676
  # CANONICAL MASTER LESSON CONTEXT (SOURCE OF TRUTH)
@@ -3169,7 +2765,7 @@ Generate complete, verified source code that satisfies the lesson objectives and
3169
2765
  # MANDATORY TEMPLATE STRUCTURE
3170
2766
  You MUST generate data aligned with this Markdown template:
3171
2767
  ---
3172
- ${CODE_LAB_TEMPLATE}
2768
+ ${loadAuthoringTemplate("LAB_TEMPLATE.md") ?? "[TEMPLATE FILE NOT FOUND: LAB_TEMPLATE.md]"}
3173
2769
  ---
3174
2770
 
3175
2771
  # CANONICAL LESSON CONTEXT (SOURCE OF TRUTH)
@@ -3667,7 +3263,7 @@ Build a complete, engaging Self-Paced Hands-On Lab (SELF_LAB) for autonomous lea
3667
3263
  # MANDATORY TEMPLATE STRUCTURE
3668
3264
  You MUST generate data aligned with this Markdown template:
3669
3265
  ---
3670
- ${SELF_LAB_TEMPLATE}
3266
+ ${loadAuthoringTemplate("SELF_LAB_template.md") ?? "[TEMPLATE FILE NOT FOUND: SELF_LAB_template.md]"}
3671
3267
  ---
3672
3268
 
3673
3269
  # INPUT PARAMETERS
@@ -3804,7 +3400,7 @@ Use this mapping to determine which Bloom level each question truly targets. Mat
3804
3400
  # MANDATORY TEMPLATE STRUCTURE
3805
3401
  You MUST generate data aligned with this Markdown template:
3806
3402
  ---
3807
- ${QUIZ_TEMPLATE}
3403
+ ${loadAuthoringTemplate("QUIZ_v4.6_template.md") ?? "[TEMPLATE FILE NOT FOUND: QUIZ_v4.6_template.md]"}
3808
3404
  ---
3809
3405
 
3810
3406
  # INPUT PARAMETERS