Skip to content

Conversation

@pavanimanchala53
Copy link
Contributor

@pavanimanchala53 pavanimanchala53 commented Dec 17, 2025

Fixes #243

Adds a single-command investor demo that:

  • Scans system hardware
  • Recommends models with reasoning
  • Runs a quick LLM test
  • Displays system readiness

Includes documentation under docs/demo.md.

Summary by CodeRabbit

  • New Features

    • Added a one-command demo that shows hardware info, recommends models based on GPU availability, runs a quick LLM test, and reports system status.
  • Documentation

    • Added a demo guide with example usage for the one-command demo.
  • Help

    • CLI help updated to include the new "notify" command.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 17, 2025

Walkthrough

Adds a new cortex demo CLI command that delegates to a new run_demo() function which runs a linear console demo: banner, hardware scan (CPU/RAM/GPU branch), model recommendations, mock LLM test, kernel/runtime status checks, and a completion summary. CLI help also updated to include a notify row. (40 words)

Changes

Cohort / File(s) Summary
CLI Integration
cortex/cli.py
Imported run_demo from cortex.demo; added demo(self) method on CortexCLI to expose cortex demo; removed inline demo stub from wizard area; restored log suppression block and updated rich help table to include a notify command row.
Demo Implementation
cortex/demo.py
New module adding run_demo() which prints branding/header, calls detect_hardware() (CPU/RAM/GPU), selects GPU- or CPU-focused model recommendations, runs a quick mock LLM test, queries Kernel Scheduler and AI Runtime status, prints completion/readiness messages, and returns an exit code.
Documentation
docs/demo.md
New docs page describing the one-command demo and example usage (cortex demo).

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant CLI as CortexCLI
    participant Demo as cortex.demo:run_demo()
    participant Branding as cortex.branding:show_banner
    participant HW as cortex.hardware_detection:detect_hardware
    participant Model as ModelRecommender
    participant LLM as MockLLM
    participant Kernel as KernelScheduler
    participant Runtime as AIRuntime

    User->>CLI: run "cortex demo"
    CLI->>Demo: invoke run_demo()
    Demo->>Branding: show banner/header
    Demo->>HW: detect_hardware()
    HW-->>Demo: hardware info (CPU, RAM, GPU?)
    alt GPU present
        Demo->>Model: recommend GPU-optimized models
    else CPU only
        Demo->>Model: recommend CPU-friendly models
    end
    Demo->>LLM: run quick mock LLM test (prompt → response)
    Demo->>Kernel: query Kernel Scheduler status
    Demo->>Runtime: query AI Runtime status
    Demo-->>CLI: return status/exit code
    CLI-->>User: print demo output/summary
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify detect_hardware() return shape and GPU fallback handling in run_demo().
  • Check that CLI command wiring registers demo correctly and removes old inline demo logic.
  • Inspect any sleeps/animations for blocking behavior and CI/fresh-install safety.

Suggested reviewers

  • mikejmorgan-ai
  • Sahilbhatane

Poem

🐰 I hopped a demo, banner bright and spry,
I scanned your chips beneath the winter sky,
I nudged some models, whispered one quick line,
I peeked the kernel, then the runtime fine,
One fluffy command — investors clap, oh my! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 2 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The description is incomplete; it lacks the checklist section required by the template, including test pass verification and PR title format validation. Add the checklist section from the template with items for test verification and PR title format, even if unchecked.
Linked Issues check ❓ Inconclusive Code changes implement core demo functionality (hardware scanning, model recommendations, LLM test) but lack evidence of runtime verification and some features like animated spinner for hardware scan. Verify implementation includes animated spinner for hardware scan, confirm total runtime meets 30-60 second requirement, and test on fresh install.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a one-command investor demo feature that fixes issue #243.
Out of Scope Changes check ✅ Passed All changes are directly related to the demo feature objective: demo.py implements core functionality, cli.py integrates the command, and docs/demo.md provides documentation.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cortex/cli.py (1)

542-548: Remove duplicate demo() method definition.

This duplicate method definition overrides the correct implementation at lines 174-182, causing the new demo feature to fail. Python will only use this second definition, which doesn't call run_demo() as intended.

Remove this duplicate method entirely:

-    def demo(self):
-        """Run a demo showing Cortex capabilities without API key"""
-        show_banner()
-        console.print()
-        cx_print("Running Demo...", "info")
-        # (Keep existing demo logic)
-        return 0
-
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dd77316 and a32234d.

📒 Files selected for processing (3)
  • cortex/cli.py (2 hunks)
  • cortex/demo.py (1 hunks)
  • docs/demo.md (1 hunks)
🧰 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
  • cortex/cli.py
🧬 Code graph analysis (2)
cortex/demo.py (2)
cortex/hardware_detection.py (1)
  • detect_hardware (632-634)
cortex/branding.py (1)
  • show_banner (35-46)
cortex/cli.py (1)
cortex/demo.py (1)
  • run_demo (7-48)
🪛 GitHub Actions: CI
cortex/cli.py

[error] 14-14: Ruff I001: Import block is un-sorted or un-formatted.

🪛 GitHub Check: Lint
cortex/demo.py

[failure] 48-48: Ruff (W292)
cortex/demo.py:48:55: W292 No newline at end of file


[failure] 1-3: Ruff (I001)
cortex/demo.py:1:1: I001 Import block is un-sorted or un-formatted

cortex/cli.py

[failure] 182-182: Ruff (W293)
cortex/cli.py:182:1: W293 Blank line contains whitespace


[failure] 178-178: Ruff (W293)
cortex/cli.py:178:1: W293 Blank line contains whitespace

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cortex/cli.py (1)

538-544: Remove duplicate demo() method definition.

This is the second definition of the demo() method (first at lines 173-179). Python will use this implementation and ignore the first one. Having duplicate method definitions is a critical correctness issue.

Based on the PR objectives to implement a full investor demo, the first implementation (lines 173-179) that delegates to run_demo() appears to be the correct one. Remove this duplicate:

-    def demo(self):
-        """Run a demo showing Cortex capabilities without API key"""
-        show_banner()
-        console.print()
-        cx_print("Running Demo...", "info")
-        # (Keep existing demo logic)
-        return 0
-
♻️ Duplicate comments (6)
cortex/cli.py (2)

14-30: Fix import order to resolve pipeline failure.

The import block is unsorted, causing the Ruff I001 pipeline failure. The cortex.demo import should be placed alphabetically among the other cortex imports.

Apply this diff to sort the imports:

 from cortex.branding import VERSION, console, cx_header, cx_print, show_banner
 from cortex.coordinator import InstallationCoordinator, StepStatus
+from cortex.demo import run_demo
 from cortex.installation_history import InstallationHistory, InstallationStatus, InstallationType
 from cortex.llm.interpreter import CommandInterpreter
 
 # Import the new Notification Manager
 from cortex.notification_manager import NotificationManager
 from cortex.user_preferences import (
     PreferencesManager,
     format_preference_value,
     print_all_preferences,
 )
 from cortex.validators import (
     validate_api_key,
     validate_install_request,
 )
-from cortex.demo import run_demo

As per coding guidelines, imports must follow PEP 8 style.


173-179: Remove duplicate method definition—only the second demo() will execute.

This demo() method at lines 173-179 is overridden by a duplicate definition at lines 538-544. Python will only use the second definition, making this implementation dead code.

If this implementation (which delegates to run_demo()) is the correct one, remove the duplicate at lines 538-544. Otherwise, remove this one.

Additionally, fix the docstring format and trailing whitespace per PEP 8:

 def demo(self):
-    """
-    Run the one-command investor demo
-    """
+    """Run the one-command investor demo."""
     return run_demo()
-    

As per coding guidelines, docstrings must follow PEP 257 conventions.

cortex/demo.py (4)

1-3: Fix import formatting to resolve pipeline failure.

The import block is unsorted (Ruff I001). Standard library imports should be separated from local imports with a blank line.

Apply this diff:

 import time
+
 from cortex.hardware_detection import detect_hardware
 from cortex.branding import show_banner
-

As per coding guidelines, imports must follow PEP 8 style.


5-5: Add required type hints and docstring per coding guidelines.

The function is missing a return type hint and docstring, violating the coding guidelines that require both for all public APIs.

Apply this diff:

-def run_demo():
+def run_demo() -> int:
+    """
+    Run the one-command investor demo showcasing Cortex capabilities.
+    
+    Performs a 30-60 second demonstration including hardware detection,
+    model recommendations, mock LLM test, and system readiness status.
+    
+    Returns:
+        int: Exit code (0 for success)
+    """
     show_banner()

As per coding guidelines, type hints and docstrings are required for all public APIs.


15-22: Fix AttributeError—SystemInfo is a dataclass, not a dict.

The code uses .get() method on the SystemInfo dataclass returned by detect_hardware(), but dataclasses don't have dict-like methods. This will raise AttributeError at runtime.

Apply this diff to use attribute access:

-    print(f"✔ CPU: {hw.get('cpu', 'Unknown')}")
-    print(f"✔ RAM: {hw.get('memory_gb', 'Unknown')} GB")
+    print(f"✔ CPU: {hw.cpu if hw.cpu else 'Unknown'}")
+    print(f"✔ RAM: {hw.memory.total_gb if hw.memory and hw.memory.total_gb else 'Unknown'} GB")
 
-    gpu = hw.get("gpu")
+    gpu = hw.gpu
     if gpu:
         print(f"✔ GPU: {gpu}")
     else:
         print("⚠️ GPU: Not detected (CPU mode enabled)")

Based on the SystemInfo dataclass structure from cortex/hardware_detection.py.


44-47: Add return value and fix whitespace issues.

The function should return an exit code (0 for success) since it's called from CLI context. Additionally, fix trailing whitespace and ensure the file ends with a newline.

Apply this diff:

     # 5️⃣ Summary
     print("\n✅ Demo Complete")
     print("🎉 Your system is READY for AI workloads\n")
-    
+    return 0

And ensure the file ends with a single newline character (no trailing whitespace).

As per coding guidelines, Python files must follow PEP 8 formatting.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a32234d and 2e1008b.

📒 Files selected for processing (2)
  • cortex/cli.py (2 hunks)
  • cortex/demo.py (1 hunks)
🧰 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
  • cortex/cli.py
🧬 Code graph analysis (2)
cortex/demo.py (2)
cortex/hardware_detection.py (1)
  • detect_hardware (632-634)
cortex/branding.py (1)
  • show_banner (35-46)
cortex/cli.py (1)
cortex/demo.py (1)
  • run_demo (5-46)
🪛 GitHub Actions: CI
cortex/cli.py

[error] 14-14: ruff check failure: Import block is un-sorted or un-formatted. I001

🪛 GitHub Check: Lint
cortex/demo.py

[failure] 47-47: Ruff (W292)
cortex/demo.py:47:5: W292 No newline at end of file


[failure] 47-47: Ruff (W293)
cortex/demo.py:47:1: W293 Blank line contains whitespace


[failure] 1-3: Ruff (I001)
cortex/demo.py:1:1: I001 Import block is un-sorted or un-formatted

cortex/cli.py

[failure] 14-30: Ruff (I001)
cortex/cli.py:14:1: I001 Import block is un-sorted or un-formatted


[failure] 179-179: Ruff (W291)
cortex/cli.py:179:39: W291 Trailing whitespace


[failure] 178-178: Ruff (W293)
cortex/cli.py:178:1: W293 Blank line contains whitespace

@pavanimanchala53 pavanimanchala53 force-pushed the feature/cortex-demo-command branch from 2e1008b to a4fca7c Compare December 17, 2025 04:54
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

♻️ Duplicate comments (4)
cortex/cli.py (1)

14-31: Fix import order to resolve pipeline failure.

The import block remains unsorted, causing the CI pipeline failure (Ruff I001). The cortex.demo import on line 31 should be placed alphabetically among the other cortex imports.

Apply this diff to fix the import order:

 from cortex.branding import VERSION, console, cx_header, cx_print, show_banner
 from cortex.coordinator import InstallationCoordinator, StepStatus
+from cortex.demo import run_demo
 from cortex.installation_history import InstallationHistory, InstallationStatus, InstallationType
 from cortex.llm.interpreter import CommandInterpreter

 # Import the new Notification Manager
 from cortex.notification_manager import NotificationManager
 from cortex.user_preferences import (
     PreferencesManager,
     format_preference_value,
     print_all_preferences,
 )
 from cortex.validators import (
     validate_api_key,
     validate_install_request,
 )
-
-from cortex.demo import run_demo
cortex/demo.py (3)

6-6: Add type hints and docstring per coding guidelines.

The function lacks a return type hint and docstring, violating the project's coding guidelines that require both for public APIs.

Apply this diff:

-def run_demo():
+def run_demo() -> int:
+    """
+    Run the one-command investor demo showcasing Cortex capabilities.
+    
+    Performs a 30-60 second demonstration including hardware detection,
+    model recommendations, mock LLM test, and system readiness status.
+    
+    Returns:
+        int: Exit code (0 for success)
+    """
     show_banner()

14-23: Fix AttributeError: SystemInfo is a dataclass, not a dict.

The code uses .get() method on hw (lines 16, 17, 19), but detect_hardware() returns a SystemInfo dataclass, not a dictionary. This will raise AttributeError at runtime.

Apply this diff to use attribute access:

     hw = detect_hardware()
 
-    print(f"✔ CPU: {hw.get('cpu', 'Unknown')}")
-    print(f"✔ RAM: {hw.get('memory_gb', 'Unknown')} GB")
+    print(f"✔ CPU: {hw.cpu if hw.cpu else 'Unknown'}")
+    print(f"✔ RAM: {hw.memory.total_gb if hw.memory and hw.memory.total_gb else 'Unknown'} GB")
 
-    gpu = hw.get("gpu")
+    gpu = hw.gpu
     if gpu:
         print(f"✔ GPU: {gpu}")
     else:

Run the following script to verify the SystemInfo structure:

#!/bin/bash
# Verify SystemInfo dataclass structure and attributes
ast-grep --pattern 'class SystemInfo'

45-48: Add return value and fix EOF formatting.

The function should return an exit code (0 for success) since it's called from CLI context. Additionally, line 48 contains trailing whitespace and the file is missing a proper newline at EOF.

Apply this diff:

     # 5️⃣ Summary
     print("\n✅ Demo Complete")
     print("🎉 Your system is READY for AI workloads\n")
-    
+    return 0
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2e1008b and a4fca7c.

📒 Files selected for processing (2)
  • cortex/cli.py (2 hunks)
  • cortex/demo.py (1 hunks)
🧰 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
  • cortex/cli.py
🧬 Code graph analysis (2)
cortex/demo.py (2)
cortex/branding.py (1)
  • show_banner (35-46)
cortex/hardware_detection.py (1)
  • detect_hardware (632-634)
cortex/cli.py (1)
cortex/demo.py (1)
  • run_demo (6-47)
🪛 GitHub Actions: CI
cortex/cli.py

[error] 14-14: Ruff: I001 Import block is un-sorted or un-formatted.

🪛 GitHub Check: Lint
cortex/demo.py

[failure] 48-48: Ruff (W292)
cortex/demo.py:48:5: W292 No newline at end of file


[failure] 48-48: Ruff (W293)
cortex/demo.py:48:1: W293 Blank line contains whitespace


[failure] 1-4: Ruff (I001)
cortex/demo.py:1:1: I001 Import block is un-sorted or un-formatted

cortex/cli.py

[failure] 14-31: Ruff (I001)
cortex/cli.py:14:1: I001 Import block is un-sorted or un-formatted


[failure] 179-179: Ruff (W291)
cortex/cli.py:179:39: W291 Trailing whitespace

🔇 Additional comments (2)
cortex/cli.py (1)

669-670: LGTM!

The demo command is properly wired from the argument parser to the CLI method, and the help table correctly includes the new demo entry.

cortex/demo.py (1)

25-38: LGTM!

The model recommendations correctly branch on GPU availability, and the mock LLM test safely demonstrates functionality without requiring actual LLM calls.

@pavanimanchala53 pavanimanchala53 force-pushed the feature/cortex-demo-command branch from a4fca7c to d76ee77 Compare December 17, 2025 05:04
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cortex/cli.py (1)

8-23: Fix import order to resolve pipeline failure.

The import block is unsorted (Ruff I001), causing the CI pipeline to fail. The cortex.demo import should be placed alphabetically between cortex.coordinator and cortex.installation_history.

Apply this diff:

 from cortex.branding import VERSION, console, cx_header, cx_print, show_banner
 from cortex.coordinator import InstallationCoordinator, StepStatus
+from cortex.demo import run_demo
 from cortex.installation_history import InstallationHistory, InstallationStatus, InstallationType
 from cortex.llm.interpreter import CommandInterpreter
 # Import the new Notification Manager
 from cortex.notification_manager import NotificationManager
 from cortex.user_preferences import (
     PreferencesManager,
     format_preference_value,
     print_all_preferences,
 )
 from cortex.validators import (
     validate_api_key,
     validate_install_request,
 )
-from cortex.demo import run_demo
-
♻️ Duplicate comments (5)
cortex/demo.py (4)

1-4: Fix import order to resolve pipeline failure.

The import block is unsorted (Ruff I001), causing the CI pipeline to fail. A blank line should separate the standard library import from local imports.

Apply this diff:

 import time
+
 from cortex.branding import show_banner
 from cortex.hardware_detection import detect_hardware
-

6-6: Add type hints and docstring per coding guidelines.

The function lacks a return type annotation and docstring, violating the project's coding guidelines that require both for public APIs (PEP 8).

Apply this diff:

-def run_demo():
+def run_demo() -> int:
+    """
+    Run the one-command investor demo showcasing Cortex capabilities.
+
+    Performs a 30-60 second demonstration including hardware detection,
+    model recommendations, mock LLM test, and system readiness status.
+
+    Returns:
+        int: Exit code (0 for success)
+    """

14-23: Fix AttributeError: SystemInfo is a dataclass, not a dict.

The code uses .get() method on SystemInfo, but it's a dataclass without dict-like methods. This will raise AttributeError at runtime. Use attribute access instead.

Apply this diff:

     hw = detect_hardware()
 
-    print(f"✔ CPU: {hw.get('cpu', 'Unknown')}")
-    print(f"✔ RAM: {hw.get('memory_gb', 'Unknown')} GB")
+    print(f"✔ CPU: {hw.cpu if hw.cpu else 'Unknown'}")
+    print(f"✔ RAM: {hw.memory.total_gb if hw.memory else 'Unknown'} GB")
 
-    gpu = hw.get("gpu")
+    gpu = hw.gpu
     if gpu:
         print(f"✔ GPU: {gpu}")

45-47: Add explicit return value for CLI exit code.

The function should return 0 for success since it's invoked from the CLI context where the return value determines the program's exit code.

Apply this diff:

     # 5️⃣ Summary
     print("\n✅ Demo Complete")
     print("🎉 Your system is READY for AI workloads\n")
+    return 0
cortex/cli.py (1)

172-177: Remove trailing whitespace.

Line 177 contains trailing whitespace after the closing comment delimiter, causing a linter failure (Ruff W291).

Apply this diff:

     def demo(self):
         """
         Run the one-command investor demo
         """
         return run_demo()
-    # --------------------------------  
+    # --------------------------------
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a4fca7c and d76ee77.

📒 Files selected for processing (2)
  • cortex/cli.py (2 hunks)
  • cortex/demo.py (1 hunks)
🧰 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
  • cortex/cli.py
🧠 Learnings (1)
📚 Learning: 2025-12-11T12:03:24.071Z
Learnt from: CR
Repo: cortexlinux/cortex PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-11T12:03:24.071Z
Learning: Applies to **/*install*.py : Implement audit logging to ~/.cortex/history.db for all package operations

Applied to files:

  • cortex/cli.py
🧬 Code graph analysis (2)
cortex/demo.py (2)
cortex/branding.py (1)
  • show_banner (35-46)
cortex/hardware_detection.py (1)
  • detect_hardware (632-634)
cortex/cli.py (1)
cortex/demo.py (1)
  • run_demo (6-47)
🪛 GitHub Actions: CI
cortex/cli.py

[error] 1-1: Import block is un-sorted or un-formatted (ruff check error).

🪛 GitHub Check: Lint
cortex/demo.py

[failure] 1-4: Ruff (I001)
cortex/demo.py:1:1: I001 Import block is un-sorted or un-formatted

cortex/cli.py

[failure] 177-177: Ruff (W291)
cortex/cli.py:177:39: W291 Trailing whitespace

🔇 Additional comments (1)
cortex/cli.py (1)

558-558: LGTM—Help table update is consistent.

The addition of the "notify" command row to the help table correctly documents the new notification management feature.

@pavanimanchala53 pavanimanchala53 force-pushed the feature/cortex-demo-command branch 5 times, most recently from 8e7bf6f to ca195b5 Compare December 17, 2025 05:48
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

♻️ Duplicate comments (4)
cortex/demo.py (4)

14-23: Fix dict-like access on SystemInfo dataclass.

The code attempts to use .get() method on SystemInfo (lines 16-17, 19), but SystemInfo is a dataclass, not a dictionary. This will raise AttributeError at runtime.

Apply this diff to use attribute access:

     hw = detect_hardware()

-    print(f"✔ CPU: {hw.get('cpu', 'Unknown')}")
-    print(f"✔ RAM: {hw.get('memory_gb', 'Unknown')} GB")
+    print(f"✔ CPU: {getattr(hw, 'cpu', 'Unknown')}")
+    print(f"✔ RAM: {getattr(hw.memory, 'total_gb', 'Unknown') if hw.memory else 'Unknown'} GB")

-    gpu = hw.get("gpu")
+    gpu = hw.gpu if hasattr(hw, 'gpu') else None
     if gpu:

Alternatively, if you prefer direct attribute access with try-except:

     hw = detect_hardware()

-    print(f"✔ CPU: {hw.get('cpu', 'Unknown')}")
-    print(f"✔ RAM: {hw.get('memory_gb', 'Unknown')} GB")
+    cpu_name = hw.cpu if hw.cpu else 'Unknown'
+    ram_gb = hw.memory.total_gb if hw.memory else 'Unknown'
+    print(f"✔ CPU: {cpu_name}")
+    print(f"✔ RAM: {ram_gb} GB")

-    gpu = hw.get("gpu")
+    gpu = hw.gpu
     if gpu:

45-47: Add explicit return value for CLI exit code.

The function should return an exit code (0 for success) since it's called from CLI context where the return value is used as the program's exit code.

Apply this diff:

     # 5️⃣ Summary
     print("\n✅ Demo Complete")
     print("🎉 Your system is READY for AI workloads\n")
+    return 0

6-6: Add required type hints and docstring for public API.

The run_demo() function is missing type hints and a docstring, which are required by the coding guidelines for all public APIs.

As per coding guidelines, apply this diff:

-def run_demo():
+def run_demo() -> int:
+    """
+    Run the one-command investor demo showcasing Cortex capabilities.
+    
+    Performs a 30-60 second demonstration including hardware detection,
+    model recommendations, mock LLM test, and system readiness status.
+    
+    Returns:
+        int: Exit code (0 for success)
+    """
     show_banner()

1-4: Fix import formatting to resolve pipeline failure.

The pipeline reports an I001 import formatting error. While the imports appear logically grouped, Ruff may require them to be sorted differently or combined.

Based on the coding guidelines, try reordering the local imports alphabetically:

 import time

-from cortex.branding import show_banner
 from cortex.hardware_detection import detect_hardware
+from cortex.branding import show_banner

Or combine them if they're from the same level:

 import time

-from cortex.branding import show_banner
-from cortex.hardware_detection import detect_hardware
+from cortex.branding import show_banner
+from cortex.hardware_detection import detect_hardware

Run ruff check cortex/demo.py locally to verify the correct format.

🧹 Nitpick comments (1)
cortex/cli.py (1)

28-28: Consider removing or relocating sys.path manipulation.

Modifying sys.path after imports is non-standard. If this is needed for development/testing, it should typically be done before any imports. However, with proper packaging and installation, this line may not be necessary at all.

If this line is required, apply this diff to move it before imports:

+import sys
+import os
+sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
+
 import argparse
 import logging
-import os
-import sys

Otherwise, consider removing it entirely if the package is properly installed.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d76ee77 and d8aaaeb.

📒 Files selected for processing (2)
  • cortex/cli.py (3 hunks)
  • cortex/demo.py (1 hunks)
🧰 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/cli.py
  • cortex/demo.py
🧬 Code graph analysis (2)
cortex/cli.py (1)
cortex/demo.py (1)
  • run_demo (6-47)
cortex/demo.py (2)
cortex/branding.py (1)
  • show_banner (35-46)
cortex/hardware_detection.py (1)
  • detect_hardware (632-634)
🪛 GitHub Actions: CI
cortex/demo.py

[error] 1-1: ruff check failed. I001 Import block is un-sorted or un-formatted.

🪛 GitHub Check: Lint
cortex/demo.py

[failure] 1-4: Ruff (I001)
cortex/demo.py:1:1: I001 Import block is un-sorted or un-formatted

🔇 Additional comments (4)
cortex/cli.py (4)

10-10: LGTM! Import correctly added and sorted.

The import of run_demo from cortex.demo is properly placed in alphabetical order with other cortex module imports.


24-26: LGTM! Appropriate logging configuration.

Suppressing noisy log messages at the module level improves the user experience during normal operation. The implementation is correct.


171-176: LGTM! Proper delegation to demo module.

The method correctly delegates to run_demo() and returns its result for use as a CLI exit code. The docstring follows PEP 257 conventions.


557-557: LGTM! Help table updated correctly.

The notify command is properly documented in the help table with clear, concise description text.

@pavanimanchala53 pavanimanchala53 force-pushed the feature/cortex-demo-command branch 3 times, most recently from ad35fe3 to ab4c237 Compare December 17, 2025 06:38
message for your changes. Lines starting
@pavanimanchala53 pavanimanchala53 force-pushed the feature/cortex-demo-command branch from ab4c237 to 7267d08 Compare December 17, 2025 06:44
@sonarqubecloud
Copy link

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 (1)
cortex/cli.py (1)

30-31: Consider removing sys.path manipulation.

Inserting the parent directory into sys.path at runtime can cause import conflicts if Cortex is installed as a package. This pattern typically indicates a packaging or import structure issue.

Consider handling module resolution through proper package installation (pip install -e .) or by setting PYTHONPATH in the development environment instead.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ab4c237 and 07b87a5.

📒 Files selected for processing (2)
  • cortex/cli.py (3 hunks)
  • cortex/demo.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (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/cli.py
🧬 Code graph analysis (1)
cortex/cli.py (1)
cortex/demo.py (1)
  • run_demo (7-50)
⏰ 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). (1)
  • GitHub Check: Build Package
🔇 Additional comments (2)
cortex/cli.py (2)

11-11: LGTM!

The import is correctly ordered alphabetically, resolving the previous Ruff I001 linting issue.


687-687: LGTM!

The help table entry for the notify command is correctly formatted and provides a clear description.

@mikejmorgan-ai
Copy link
Member

⚠️ This PR has merge conflicts. Please rebase on main to resolve conflicts before it can be reviewed and merged.

@pavanimanchala53
Copy link
Contributor Author

⚠️ This PR has merge conflicts. Please rebase on main to resolve conflicts before it can be reviewed and merged.
rebase done

@mikejmorgan-ai mikejmorgan-ai merged commit c59bb93 into cortexlinux:main Dec 20, 2025
13 checks passed
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.

cortex demo: One-Command Investor Showcase

2 participants