Skip to content

added beginner companion previews to every lesson#318

Open
isudhir wants to merge 2 commits into
rohitg00:mainfrom
isudhir:feat/beginner-companion-previews
Open

added beginner companion previews to every lesson#318
isudhir wants to merge 2 commits into
rohitg00:mainfrom
isudhir:feat/beginner-companion-previews

Conversation

@isudhir

@isudhir isudhir commented Jun 30, 2026

Copy link
Copy Markdown

What this PR does

Adds beginner-friendly "Companion Previews" to every lesson, giving newcomers a short, plain-language introduction that explains what the lesson is about, why it matters, and what they'll learn before they begin.

Kind of change

  • Docs / website / tooling

Checklist

  • Code runs without errors with the listed dependencies
  • Tested locally / code output matches what docs/en.md claims

Phase / lesson

All phases (00–19)

  • Companion previews added for all 503 lessons.
  • Website updated to render previews on every lesson page.

Notes for reviewer

Motivation

The lessons intentionally build everything from first principles, which is excellent for learning but can feel overwhelming to beginners. Before opening a lesson, many readers don't yet know:

  • What this topic is
  • Why it exists
  • Why they should spend time learning it

This PR introduces a short, beginner-oriented preview before every lesson. Each preview is written in simple, conversational language (avoiding unnecessary jargon) to help readers understand the purpose and practical value of the lesson before diving into the technical content.

The goal is to reduce the barrier to entry without modifying any existing lesson material.

What's included

Documentation

  • Added companion previews for all 503 lessons across all 20 phases.
  • Added previews to the companion guide master index and each phase guide.
  • Each lesson now has a concise "read before you start" introduction.

Website

  • Updated site/build.js to parse companion guide content and inject a companion field into each lesson during site generation.
  • Supports both lesson layouts:
    • Standard lesson layout (Phases 00–18)
    • Track-grouped capstone layout (Phase 19)
  • Regenerated site/data.js with companion data for every lesson.
  • Updated site/lesson.html to display a themed, collapsible "New to this? Start here" panel beneath each lesson title.
  • Companion headings are excluded from the lesson table of contents to keep navigation focused on the lesson itself.

Testing

  • Rebuilt the site successfully.
  • Verified that companion previews render correctly across standard lessons and capstone lessons.
  • Confirmed that existing lesson content remains unchanged and only the additional preview section is introduced.

Additional note

I also reset the website's progress tracker to 0% because my local progress state showed every lesson as completed, which caused the generated site to display all lessons as finished. This change is only intended to restore the default experience for new users.

If you'd prefer to keep the existing progress state or handle it differently, I'm happy to remove this change from the PR.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a 20-phase beginner companion guide under docs/companion-guide/ (phases 00–19, ~12,000 lines of markdown). The build pipeline is extended to parse these guides and attach per-lesson companion sections to lesson objects. lesson.html gains a collapsible companion preview UI. app.js switches completion tracking to use only AIFSProgress. A server.py local dev server is added.

Changes

Companion Preview Feature and Site Changes

Layer / File(s) Summary
Build: companion parsing and attachment
site/build.js
parseCompanionGuide(phaseSlug) reads and parses phase markdown into {title, body} sections; build() attaches them to lessons by index via lesson.companion.
lesson.html: collapsible companion preview UI
site/lesson.html
Adds CSS for .companion-preview; renderLesson calls insertCompanionPreview which parses markdown, demotes headings, and wires aria-expanded toggle.
app.js: completion stats use user progress only
site/app.js
computeStats() and renderPhases() remove static status field checks; all counts derive from window.AIFSProgress.isLessonComplete on lesson URLs.
Local dev server
server.py
Serves site/ directory on port 8799 via SimpleHTTPRequestHandler.

Companion Guide Documentation (Phases 00–19)

Layer / File(s) Summary
Guide index
docs/companion-guide/README.md
Introduces the guide structure, rating legend, and a table of all 20 phases with lesson counts and difficulty labels.
Phases 00–03
docs/companion-guide/00-setup-and-tooling/..., 01-math-foundations/..., 02-ml-fundamentals/..., 03-deep-learning-core/...
Full phase READMEs for Setup & Tooling, Math Foundations, ML Fundamentals, and Deep Learning Core, each with lesson-by-lesson overviews and phase summaries.
Phases 04–06
docs/companion-guide/04-computer-vision/..., 05-nlp-foundations-to-advanced/..., 06-speech-and-audio/...
Full phase READMEs for Computer Vision, NLP Foundations to Advanced, and Speech & Audio.
Phases 07–10
docs/companion-guide/07-transformers-deep-dive/..., 08-generative-ai/..., 09-reinforcement-learning/..., 10-llms-from-scratch/...
Full phase READMEs for Transformers Deep Dive, Generative AI, Reinforcement Learning, and LLMs From Scratch.
Phases 11–15
docs/companion-guide/11-llm-engineering/..., 12-multimodal-ai/..., 13-tools-and-protocols/..., 14-agent-engineering/..., 15-autonomous-systems/...
Full phase READMEs for LLM Engineering, Multimodal AI, Tools and Protocols, Agent Engineering, and Autonomous Systems.
Phases 16–19
docs/companion-guide/16-multi-agent-and-swarms/..., 17-infrastructure-and-production/..., 18-ethics-safety-alignment/..., 19-capstone-projects/...
Full phase READMEs for Multi-Agent and Swarms, Infrastructure and Production, Ethics/Safety/Alignment, and Capstone Projects.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding beginner companion previews to lessons.
Description check ✅ Passed The description is detailed and directly matches the documentation and website changes in this PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@isudhir isudhir force-pushed the feat/beginner-companion-previews branch from ffc2390 to dcc8b85 Compare June 30, 2026 11:57
@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

@isudhir is attempting to deploy a commit to the OSS program Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (4)
docs/companion-guide/07-transformers-deep-dive/README.md (1)

189-189: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Hyphenate "end-to-end."

"Knowing the full block end to end" should use "end-to-end" as a compound modifier. Standard English hyphenation for compound adverbs/adjectives.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/companion-guide/07-transformers-deep-dive/README.md` at line 189,
Hyphenate the phrase in the transformer deep dive README so it reads as
“end-to-end” instead of “end to end.” Update the sentence containing “Knowing
the full block end to end” in the relevant section to use the standard compound
modifier form, keeping the rest of the wording unchanged.

Source: Linters/SAST tools

docs/companion-guide/04-computer-vision/README.md (1)

774-774: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Hyphenate "soft-colored."

Per standard English hyphenation, compound adjectives before a noun should be hyphenated: "soft-colored cotton balls."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/companion-guide/04-computer-vision/README.md` at line 774, The phrase in
the companion guide uses a compound adjective before a noun without hyphenation;
update the wording in the relevant README paragraph so “soft colored” becomes
“soft-colored.” Keep the rest of the sentence unchanged and make the edit in the
text associated with the described scene comparison.

Source: Linters/SAST tools

site/lesson.html (1)

2080-2107: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Link the toggle to its body with aria-controls / id for assistive tech.

The toggle correctly drives aria-expanded and hidden, but there's no programmatic association between the button and the panel it controls. Adding an id on the body and aria-controls on the button improves screen-reader navigation of the collapsible.

♿ Proposed a11y wiring
-          '<button class="companion-toggle" type="button" aria-expanded="false">' +
+          '<button class="companion-toggle" type="button" aria-expanded="false" aria-controls="companion-body">' +
             '<span class="companion-toggle-main">' +
               '<span class="companion-toggle-kicker">New to this? Start here</span>' +
               '<span class="companion-toggle-title">Read a plain-English preview of this lesson</span>' +
             '</span>' +
             '<span class="companion-toggle-icon" aria-hidden="true">+</span>' +
           '</button>' +
-          '<div class="companion-body" hidden>' + bodyHtml + '</div>';
+          '<div class="companion-body" id="companion-body" hidden>' + bodyHtml + '</div>';
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@site/lesson.html` around lines 2080 - 2107, The companion preview toggle in
the article setup needs an explicit accessibility link between the button and
the collapsible body. Update the `companion-toggle` button and `companion-body`
in this block so the button gets an `aria-controls` value and the panel gets a
matching unique `id`, while keeping the existing `aria-expanded` and `hidden`
behavior in the click handler. Use the existing `wrap`, `btn`, and `body`
references to wire the association without changing the toggle logic.
site/app.js (1)

56-62: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Duplicated user-completion lookup — extract a small helper.

The same extractPath + isLessonComplete guard is repeated three times (lesson loop, phase loop, renderPhases). A single helper keeps the contract with AIFSProgress in one place and avoids divergence if the lookup changes.

♻️ Example helper
+  function isUserComplete(lesson) {
+    if (!window.AIFSProgress || !lesson || !lesson.url) return false;
+    var p = window.AIFSProgress.extractPath(lesson.url);
+    return !!(p && window.AIFSProgress.isLessonComplete(p));
+  }

Also applies to: 71-78, 131-138

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@site/app.js` around lines 56 - 62, The lesson-completion lookup is duplicated
across the lesson loop, phase loop, and renderPhases, so extract the repeated
`window.AIFSProgress.extractPath` plus `isLessonComplete` guard into one small
helper in `site/app.js`. Update the existing `userDone` checks to call that
helper everywhere the completion state is computed, keeping the `AIFSProgress`
contract centralized and consistent. Use the helper wherever the current
completion logic appears so future lookup changes only need to be made once.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@server.py`:
- Around line 11-12: The server startup in socketserver.TCPServer is binding to
all interfaces via an empty host, which conflicts with the localhost-only
behavior implied by the print message. Update the TCPServer instantiation in
server.py to bind explicitly to 127.0.0.1 unless remote access is intentionally
required, keeping the existing Handler and PORT usage unchanged.
- Line 7: The startup logic in server.py uses os.chdir("site"), which depends on
the caller’s current working directory. Update the server setup to resolve the
site directory relative to the script location using
Path(__file__).resolve().parent and then either change into that absolute path
or pass it directly to SimpleHTTPRequestHandler(directory=...). This keeps the
server location-independent and preserves the existing server startup flow.

---

Nitpick comments:
In `@docs/companion-guide/04-computer-vision/README.md`:
- Line 774: The phrase in the companion guide uses a compound adjective before a
noun without hyphenation; update the wording in the relevant README paragraph so
“soft colored” becomes “soft-colored.” Keep the rest of the sentence unchanged
and make the edit in the text associated with the described scene comparison.

In `@docs/companion-guide/07-transformers-deep-dive/README.md`:
- Line 189: Hyphenate the phrase in the transformer deep dive README so it reads
as “end-to-end” instead of “end to end.” Update the sentence containing “Knowing
the full block end to end” in the relevant section to use the standard compound
modifier form, keeping the rest of the wording unchanged.

In `@site/app.js`:
- Around line 56-62: The lesson-completion lookup is duplicated across the
lesson loop, phase loop, and renderPhases, so extract the repeated
`window.AIFSProgress.extractPath` plus `isLessonComplete` guard into one small
helper in `site/app.js`. Update the existing `userDone` checks to call that
helper everywhere the completion state is computed, keeping the `AIFSProgress`
contract centralized and consistent. Use the helper wherever the current
completion logic appears so future lookup changes only need to be made once.

In `@site/lesson.html`:
- Around line 2080-2107: The companion preview toggle in the article setup needs
an explicit accessibility link between the button and the collapsible body.
Update the `companion-toggle` button and `companion-body` in this block so the
button gets an `aria-controls` value and the panel gets a matching unique `id`,
while keeping the existing `aria-expanded` and `hidden` behavior in the click
handler. Use the existing `wrap`, `btn`, and `body` references to wire the
association without changing the toggle logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 25962591-d87f-425f-ba67-537d8a99f03e

📥 Commits

Reviewing files that changed from the base of the PR and between c8b9b92 and dcc8b85.

📒 Files selected for processing (26)
  • docs/companion-guide/00-setup-and-tooling/README.md
  • docs/companion-guide/01-math-foundations/README.md
  • docs/companion-guide/02-ml-fundamentals/README.md
  • docs/companion-guide/03-deep-learning-core/README.md
  • docs/companion-guide/04-computer-vision/README.md
  • docs/companion-guide/05-nlp-foundations-to-advanced/README.md
  • docs/companion-guide/06-speech-and-audio/README.md
  • docs/companion-guide/07-transformers-deep-dive/README.md
  • docs/companion-guide/08-generative-ai/README.md
  • docs/companion-guide/09-reinforcement-learning/README.md
  • docs/companion-guide/10-llms-from-scratch/README.md
  • docs/companion-guide/11-llm-engineering/README.md
  • docs/companion-guide/12-multimodal-ai/README.md
  • docs/companion-guide/13-tools-and-protocols/README.md
  • docs/companion-guide/14-agent-engineering/README.md
  • docs/companion-guide/15-autonomous-systems/README.md
  • docs/companion-guide/16-multi-agent-and-swarms/README.md
  • docs/companion-guide/17-infrastructure-and-production/README.md
  • docs/companion-guide/18-ethics-safety-alignment/README.md
  • docs/companion-guide/19-capstone-projects/README.md
  • docs/companion-guide/README.md
  • server.py
  • site/app.js
  • site/build.js
  • site/data.js
  • site/lesson.html

Comment thread server.py Outdated
Comment thread server.py Outdated
@isudhir

isudhir commented Jun 30, 2026

Copy link
Copy Markdown
Author

@rohitg00 , let me know if this looks good or need some changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant