-
-
Notifications
You must be signed in to change notification settings - Fork 29
feat: Complete interactive demo with 6 sections #370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Smart installation with transparent planning phase - Hardware-aware intelligence demonstrations - AI natural language understanding - Smart stacks workflow (list and install) - Installation history tracking - Rollback protection demonstration - Comparison table finale showing key differentiators - Clear screen between sections for better UX - ~5 minute interactive tutorial - Matches actual Cortex output with CX branding Users type real commands to build muscle memory. Accepts any input for learning (no validation friction). Closes cortexlinux#366
📝 WalkthroughWalkthroughReplaces the procedural demo with a new class-based interactive tutorial: adds Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant D as CortexDemo
participant H as HardwareDetector
participant O as SimulatedCortexOutput
U->>D: start/run()
D->>H: detect_hardware()
H-->>D: hardware info (GPU/CPU,NVIDIA/AMD)
D->>U: render intro & prompts (sections)
alt user enters command
U->>D: command input (install/ask/stack)
D->>O: _simulate_cortex_output(command, packages)
O-->>D: simulated plan/output
D->>U: display plan, prompts (hint/skip)
else user interrupts
U->>D: Ctrl+C / EOF
D-->>U: handle interruption, return non-zero
end
D->>U: show finale & next steps
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (2)
cortex/demo.py (2)
206-217: Usegpu_infoconsistently instead of re-accessinggpu[0].After extracting
gpu_info = gpu[0], the code still accessesgpu[0].modeldirectly on lines 217, 239, and 252. Usinggpu_info.modelwould be more consistent and slightly cleaner.🔎 Proposed fix
if has_nvidia: # NVIDIA GPU - show successful CUDA install - self.console.print(f"[cyan]Detected GPU:[/cyan] {gpu[0].model}") + self.console.print(f"[cyan]Detected GPU:[/cyan] {gpu_info.model}")Apply similar changes to lines 239 and 252.
411-438: Consider using dynamic dates for the history table.The hardcoded dates (e.g., "2025-12-26 13:11:51") will appear stale as time passes. For a more polished demo, consider generating dates relative to the current time.
🔎 Example approach
from datetime import datetime, timedelta now = datetime.now() dates = [ now.strftime("%Y-%m-%d %H:%M:%S"), (now - timedelta(days=1)).strftime("%Y-%m-%d %H:%M:%S"), (now - timedelta(days=1, hours=1)).strftime("%Y-%m-%d %H:%M:%S"), (now - timedelta(days=2)).strftime("%Y-%m-%d %H:%M:%S"), ]
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
cortex/demo.py
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
**/*.py: Follow PEP 8 style guide
Type hints required in Python code
Docstrings required for all public APIs
Files:
cortex/demo.py
🧬 Code graph analysis (1)
cortex/demo.py (3)
cortex/branding.py (1)
show_banner(35-46)cortex/cli.py (2)
status(797-828)demo(180-184)cortex/progress_indicators.py (1)
total_steps(99-100)
🪛 GitHub Actions: CI
cortex/demo.py
[error] 6-6: I001 Import block is un-sorted or un-formatted (ruff).
🪛 GitHub Check: lint
cortex/demo.py
[failure] 63-63: Ruff (W293)
cortex/demo.py:63:1: W293 Blank line contains whitespace
[failure] 60-60: Ruff (W293)
cortex/demo.py:60:1: W293 Blank line contains whitespace
[failure] 58-58: Ruff (W293)
cortex/demo.py:58:1: W293 Blank line contains whitespace
[failure] 49-49: Ruff (W291)
cortex/demo.py:49:73: W291 Trailing whitespace
[failure] 44-44: Ruff (W293)
cortex/demo.py:44:1: W293 Blank line contains whitespace
[failure] 41-41: Ruff (W293)
cortex/demo.py:41:1: W293 Blank line contains whitespace
[failure] 35-35: Ruff (W293)
cortex/demo.py:35:1: W293 Blank line contains whitespace
[failure] 31-31: Ruff (W293)
cortex/demo.py:31:1: W293 Blank line contains whitespace
[failure] 21-21: Ruff (W293)
cortex/demo.py:21:1: W293 Blank line contains whitespace
[failure] 6-16: Ruff (I001)
cortex/demo.py:6:1: I001 Import block is un-sorted or un-formatted
🪛 GitHub Check: Lint
cortex/demo.py
[failure] 63-63: Ruff (W293)
cortex/demo.py:63:1: W293 Blank line contains whitespace
[failure] 60-60: Ruff (W293)
cortex/demo.py:60:1: W293 Blank line contains whitespace
[failure] 58-58: Ruff (W293)
cortex/demo.py:58:1: W293 Blank line contains whitespace
[failure] 49-49: Ruff (W291)
cortex/demo.py:49:73: W291 Trailing whitespace
[failure] 44-44: Ruff (W293)
cortex/demo.py:44:1: W293 Blank line contains whitespace
[failure] 41-41: Ruff (W293)
cortex/demo.py:41:1: W293 Blank line contains whitespace
[failure] 35-35: Ruff (W293)
cortex/demo.py:35:1: W293 Blank line contains whitespace
[failure] 31-31: Ruff (W293)
cortex/demo.py:31:1: W293 Blank line contains whitespace
[failure] 21-21: Ruff (W293)
cortex/demo.py:21:1: W293 Blank line contains whitespace
[failure] 6-16: Ruff (I001)
cortex/demo.py:6:1: I001 Import block is un-sorted or un-formatted
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: test (3.10)
- GitHub Check: test (3.11)
- GitHub Check: test (3.12)
🔇 Additional comments (8)
cortex/demo.py (8)
95-105: LGTM!The method correctly handles both interactive and non-interactive modes, with proper exception handling for user interruption.
107-124: LGTM!The method correctly implements the "accept any input for learning" design goal while maintaining proper exception handling.
126-171: LGTM!The simulation logic is well-structured with clear phases (understanding, planning, execution) and proper CX branding. The optional
show_executionparameter provides flexibility for different demo scenarios.
288-333: LGTM!The AI features section effectively demonstrates the
cortex askcapability with a well-formatted response panel.
335-389: LGTM!The stacks section provides a clear demonstration of the workflow bundles feature with a well-formatted table and simulated installation.
448-476: LGTM!The rollback section effectively demonstrates the undo capability and ties back to the installation ID from earlier sections.
478-564: LGTM!The finale provides a compelling comparison table and comprehensive next steps, making for a polished conclusion to the demo.
567-573: LGTM!The entry point is clean and correctly delegates to the new class-based implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
cortex/demo.py (3)
13-13: Remove unused imports fromrich.progress.
BarColumn,Progress,SpinnerColumn, andTextColumnare imported but never used in this file. The code usesself.console.status()which doesn't require these explicit imports.🔎 Proposed fix
-from rich.progress import BarColumn, Progress, SpinnerColumn, TextColumn
23-27: Add type annotation forself.hwand docstring for__init__.Per coding guidelines, type hints are required in Python code and docstrings are required for all public APIs.
self.hwlacks a type annotation, and__init__lacks a docstring.🔎 Proposed fix
def __init__(self): + """Initialize the interactive demo with console and state.""" self.console = Console() - self.hw = None + self.hw: Optional[object] = None # Set by detect_hardware() self.is_interactive = sys.stdin.isatty() self.installation_id = self._generate_id()
131-133: Add return type hint for consistency.Per coding guidelines, type hints are required. This method implicitly returns
None.🔎 Proposed fix
def _simulate_cortex_output( self, command: str, packages: list[str], show_execution: bool = False - ): + ) -> None:
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
cortex/demo.pycortex/dependency_check.py
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
**/*.py: Follow PEP 8 style guide
Type hints required in Python code
Docstrings required for all public APIs
Files:
cortex/demo.pycortex/dependency_check.py
🧬 Code graph analysis (1)
cortex/demo.py (3)
cortex/branding.py (1)
show_banner(35-46)cortex/cli.py (2)
status(797-828)demo(180-184)cortex/progress_indicators.py (1)
total_steps(99-100)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Build Package
- GitHub Check: test (3.11)
- GitHub Check: test (3.10)
- GitHub Check: test (3.12)
🔇 Additional comments (13)
cortex/dependency_check.py (1)
46-46: LGTM!Trivial stylistic change from single to double quotes in the join delimiter. No functional impact.
cortex/demo.py (12)
29-35: LGTM!Both
clear_screenand_generate_idare well-documented with appropriate docstrings and type hints.
37-98: LGTM!The
runmethod is well-structured with proper error handling forKeyboardInterruptandEOFError, clear section progression, and appropriate return codes.
100-110: LGTM!Clean implementation with proper non-interactive mode support for CI and robust exception handling.
112-129: LGTM!Zero-validation approach aligns with PR objectives for a learning-focused demo. Good exception handling.
187-211: LGTM!Well-structured section with clear flow: explanation → command prompt → simulation → feature highlight.
213-322: LGTM!Hardware detection logic is sound with proper null checks. The three branches (NVIDIA/AMD/no GPU) provide good coverage for different user scenarios.
324-373: LGTM!Clean AI features section with well-formatted response content and appropriate Panel display.
375-431: LGTM!Stacks section effectively demonstrates listing and installation with proper table formatting.
433-474: LGTM!History section with appropriate example data. Hardcoded dates are acceptable for demo purposes.
476-512: LGTM!Rollback section cleanly demonstrates the undo capability with proper ID generation.
514-574: LGTM!Excellent finale with a compelling comparison table and comprehensive next steps. The summary effectively reinforces what users learned.
577-583: LGTM!Clean entry point that preserves the existing API while delegating to the new class-based implementation. Matches CLI integration in
cortex/cli.py.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (5)
cortex/demo.py (5)
13-13: Remove unused imports from rich.progress.The imports
BarColumn,Progress,SpinnerColumn, andTextColumnare not used in this file. The demo only usesself.console.status(...)contexts, which don't require these imports.🔎 Proposed fix
-from rich.progress import BarColumn, Progress, SpinnerColumn, TextColumn
23-27: Consider adding a docstring and type annotation for better API documentation.The
__init__method lacks a docstring, andself.hwhas no type annotation. Per coding guidelines, docstrings are required for public APIs.🔎 Proposed enhancement
def __init__(self): + """ + Initialize the interactive demo. + + Sets up console, hardware detection placeholder, interactivity detection, + and generates a unique installation ID for demo purposes. + """ self.console = Console() - self.hw = None + self.hw: Optional[object] = None # Set by detect_hardware() self.is_interactive = sys.stdin.isatty() self.installation_id = self._generate_id()
29-31: Add return type annotation for consistency.Per coding guidelines, type hints are required. The
clear_screenmethod should explicitly declare-> None.🔎 Proposed fix
- def clear_screen(self): + def clear_screen(self) -> None: """Clears the terminal screen""" self.console.clear()
128-131: Add return type annotation.The method should declare
-> Noneper coding guidelines requiring type hints.🔎 Proposed fix
def _simulate_cortex_output( - self, command: str, packages: list[str], show_execution: bool = False + self, command: str, packages: list[str], show_execution: bool = False + ) -> None: - ): """Simulate real Cortex output with CX branding"""
184-186: Add return type annotation.Per coding guidelines, the method should declare
-> boolas its return type.🔎 Proposed fix
- def _section_ai_intelligence(self) -> bool: + def _section_ai_intelligence(self) -> bool: """Section 1: AI Intelligence - NLP, Planning, and Hardware Awareness"""(Note: The return type is actually already present in the signature. This might be a display issue.)
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
cortex/demo.py
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
**/*.py: Follow PEP 8 style guide
Type hints required in Python code
Docstrings required for all public APIs
Files:
cortex/demo.py
🧬 Code graph analysis (1)
cortex/demo.py (3)
cortex/branding.py (1)
show_banner(35-46)cortex/cli.py (2)
status(797-828)demo(180-184)cortex/progress_indicators.py (1)
total_steps(99-100)
🪛 GitHub Actions: CI
cortex/demo.py
[error] 577-577: W292 No newline at end of file.
🪛 GitHub Check: lint
cortex/demo.py
[failure] 577-577: Ruff (W292)
cortex/demo.py:577:22: W292 No newline at end of file
🪛 GitHub Check: Lint
cortex/demo.py
[failure] 577-577: Ruff (W292)
cortex/demo.py:577:22: W292 No newline at end of file
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: test (3.12)
- GitHub Check: test (3.10)
- GitHub Check: test (3.11)
🔇 Additional comments (6)
cortex/demo.py (6)
37-96: LGTM! Well-structured demo orchestration.The
run()method has a clear flow: initialization, hardware detection, section execution, and finale. Error handling properly catches interruptions and returns appropriate exit codes. The section loop design allows early exit on user interruption.
97-127: LGTM! Robust user interaction handling.Both methods properly handle interactive vs. non-interactive modes and gracefully catch interruptions. The design choice to accept any input in
_prompt_command(line 118) aligns with the learning-friendly objective stated in the PR.
263-278: LGTM! Robust GPU detection with multiple vendor support.The GPU detection logic safely handles the case where hardware info is unavailable (lines 263-264) and checks for both NVIDIA and AMD GPUs using case-insensitive pattern matching. The three-way branching (NVIDIA/AMD/no-GPU) provides tailored demos for each scenario.
365-424: LGTM! Clear demonstration of stacks feature.The section effectively showcases the stacks workflow with a well-formatted table of available stacks and a complete installation simulation. The tip about creating custom stacks (lines 421-422) is a nice touch.
426-506: LGTM! Excellent narrative continuity.The section effectively demonstrates history tracking and rollback features. The use of
self.installation_idfrom the earlier webdev stack installation (line 449, 478, 481) creates excellent narrative continuity throughout the demo.
508-569: LGTM! Compelling finale with clear value proposition.The comparison table (lines 519-536) effectively highlights Cortex's differentiators, and the summary panel provides actionable next steps with correct command syntax. Recommending
cortex wizardas the first step (line 553) is good UX guidance.


Summary
Completely redesigned
cortex demofrom a 5-second hardware check into a comprehensive 5-minute interactive tutorial.Changes
Before
After
Sections
cortex askwith intelligent recommendationscortex stack)Key Features
Testing
Video demonstration:
Screencast from 26-12-25 03:45:52 PM IST.webm
Closes #366