added beginner companion previews to every lesson#318
Conversation
📝 WalkthroughWalkthroughAdds a 20-phase beginner companion guide under ChangesCompanion Preview Feature and Site Changes
Companion Guide Documentation (Phases 00–19)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
ffc2390 to
dcc8b85
Compare
|
@isudhir is attempting to deploy a commit to the OSS program Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (4)
docs/companion-guide/07-transformers-deep-dive/README.md (1)
189-189: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueHyphenate "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 valueHyphenate "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 valueLink the toggle to its body with
aria-controls/idfor assistive tech.The toggle correctly drives
aria-expandedandhidden, but there's no programmatic association between the button and the panel it controls. Adding anidon the body andaria-controlson 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 valueDuplicated user-completion lookup — extract a small helper.
The same
extractPath+isLessonCompleteguard is repeated three times (lesson loop, phase loop,renderPhases). A single helper keeps the contract withAIFSProgressin 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
📒 Files selected for processing (26)
docs/companion-guide/00-setup-and-tooling/README.mddocs/companion-guide/01-math-foundations/README.mddocs/companion-guide/02-ml-fundamentals/README.mddocs/companion-guide/03-deep-learning-core/README.mddocs/companion-guide/04-computer-vision/README.mddocs/companion-guide/05-nlp-foundations-to-advanced/README.mddocs/companion-guide/06-speech-and-audio/README.mddocs/companion-guide/07-transformers-deep-dive/README.mddocs/companion-guide/08-generative-ai/README.mddocs/companion-guide/09-reinforcement-learning/README.mddocs/companion-guide/10-llms-from-scratch/README.mddocs/companion-guide/11-llm-engineering/README.mddocs/companion-guide/12-multimodal-ai/README.mddocs/companion-guide/13-tools-and-protocols/README.mddocs/companion-guide/14-agent-engineering/README.mddocs/companion-guide/15-autonomous-systems/README.mddocs/companion-guide/16-multi-agent-and-swarms/README.mddocs/companion-guide/17-infrastructure-and-production/README.mddocs/companion-guide/18-ethics-safety-alignment/README.mddocs/companion-guide/19-capstone-projects/README.mddocs/companion-guide/README.mdserver.pysite/app.jssite/build.jssite/data.jssite/lesson.html
|
@rohitg00 , let me know if this looks good or need some changes |
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
Checklist
docs/en.mdclaimsPhase / lesson
All phases (00–19)
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:
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
Website
site/build.jsto parse companion guide content and inject acompanionfield into each lesson during site generation.site/data.jswith companion data for every lesson.site/lesson.htmlto display a themed, collapsible "New to this? Start here" panel beneath each lesson title.Testing
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.