Skip to content

Add hyperai CLI and fix console_scripts entry point#10

Open
NguyenCuong1989 wants to merge 2 commits into
mainfrom
codex/update-entry_points-for-cli-scripts
Open

Add hyperai CLI and fix console_scripts entry point#10
NguyenCuong1989 wants to merge 2 commits into
mainfrom
codex/update-entry_points-for-cli-scripts

Conversation

@NguyenCuong1989
Copy link
Copy Markdown
Collaborator

@NguyenCuong1989 NguyenCuong1989 commented Feb 9, 2026

User description

Motivation

  • Fix the package console script so installed hyperai invokes the correct module instead of referencing src. in entry_points.
  • Provide a minimal command-line interface so the package exposes a usable main() entry point for hyperai.
  • Make the CLI available from the package public API so hyperai.cli:main can be referenced and tested.

Description

  • Updated setup.py to set the console script to hyperai=hyperai.cli:main instead of hyperai=src.hyperai:main.
  • Added src/hyperai/cli.py containing a basic main(argv: list[str] | None = None) -> int with --version and --info handling and a helper _get_version() using importlib.metadata.
  • Imported and exported the CLI entry by adding from .cli import main and adding "main" to __all__ in src/hyperai/__init__.py.

Testing

  • No automated tests were run for this change.

Codex Task

Tóm tắt bởi Sourcery

Thêm một giao diện dòng lệnh tối thiểu cho package hyperai và kết nối nó làm entry point console script của package.

Tính năng mới:

  • Giới thiệu CLI hyperai với hàm entry point main() hỗ trợ các lệnh --version--info.
  • Công khai hàm main() của CLI thông qua public API của package hyperai.

Cải tiến:

  • Cập nhật entry point console_scripts để gọi hyperai.cli:main thay vì module src.hyperai.
Original summary in English

Tóm tắt bởi Sourcery

Giới thiệu một giao diện dòng lệnh tối giản cho package hyperai và cấu hình nó làm entry point console của package.

Tính năng mới:

  • Thêm module CLI hyperai cung cấp entry point main() với các lệnh cơ bản --version--info.
  • Mở rộng hàm main() của CLI thông qua public API của package hyperai.

Cải tiến:

  • Cập nhật entry point console_scripts để gọi hyperai.cli:main thay vì module src.hyperai.
Original summary in English

Summary by Sourcery

Introduce a minimal command-line interface for the hyperai package and wire it up as the package’s console entry point.

New Features:

  • Add a hyperai CLI module exposing a main() entry point with basic --version and --info commands.
  • Expose the CLI main() function through the hyperai package’s public API.

Enhancements:

  • Update the console_scripts entry point to invoke hyperai.cli:main instead of the src.hyperai module.

PR Type

Enhancement


Description

  • Add minimal CLI with --version and --info flags

  • Fix console_scripts entry point to reference hyperai.cli:main

  • Export CLI main() function via public package API


Diagram Walkthrough

flowchart LR
  A["setup.py<br/>console_scripts"] -->|"updated to<br/>hyperai.cli:main"| B["src/hyperai/cli.py<br/>new CLI module"]
  B -->|"main function"| C["src/hyperai/__init__.py<br/>public API"]
  C -->|"exports"| D["hyperai package<br/>CLI accessible"]
Loading

File Walkthrough

Relevant files
Configuration changes
setup.py
Fix console_scripts entry point reference                               

setup.py

  • Updated console_scripts entry point from hyperai=src.hyperai:main to
    hyperai=hyperai.cli:main
  • Fixes incorrect module reference that would fail when package is
    installed
+1/-1     
Enhancement
cli.py
Create CLI module with argument parsing                                   

src/hyperai/cli.py

  • New file implementing command-line interface for HYPERAI Framework
  • main(argv) function with argparse supporting --version and --info
    flags
  • _get_version() helper using importlib.metadata to fetch package
    version
  • Includes if __name__ == "__main__" block for direct execution
+45/-0   
__init__.py
Export CLI main function in public API                                     

src/hyperai/init.py

  • Import main function from new cli module
  • Add "main" to __all__ list to expose CLI via public API
  • Enables hyperai.cli:main to be referenced and tested
+4/-0     

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Feb 9, 2026

Hướng dẫn cho người review

Thêm một giao diện dòng lệnh (CLI) tối giản cho package hyperai, nối nó với entry point console_scripts, và cung cấp hàm CLI main() thông qua public API của package.

Biểu đồ tuần tự cho luồng gọi hyperai CLI

sequenceDiagram
    actor User
    participant Shell
    participant ConsoleScriptsEntryPoint as console_scripts_entry_point
    participant HyperaiCli as hyperai_cli_main
    participant Argparse
    participant ImportlibMetadata as importlib_metadata

    User->>Shell: hyperai --info
    Shell->>ConsoleScriptsEntryPoint: invoke hyperai
    ConsoleScriptsEntryPoint->>HyperaiCli: main(argv)
    HyperaiCli->>Argparse: ArgumentParser.parse_args(argv)
    Argparse-->>HyperaiCli: args
    alt args.version requested
        HyperaiCli->>ImportlibMetadata: version(hyperai-framework)
        ImportlibMetadata-->>HyperaiCli: version string or PackageNotFoundError
        HyperaiCli-->>User: prints version
    else args.info is True
        HyperaiCli-->>User: prints framework information
    else no flags
        HyperaiCli->>Argparse: print_help()
        Argparse-->>User: help text
    end
    HyperaiCli-->>ConsoleScriptsEntryPoint: return 0
    ConsoleScriptsEntryPoint-->>Shell: process exit 0
Loading

Biểu đồ lớp đã cập nhật cho việc expose hyperai CLI và entry point

classDiagram
    class hyperai {
        <<module>>
        +main(argv list[str] or None) int
    }

    class hyperai_cli {
        <<module>>
        +main(argv list[str] or None) int
        -_get_version() str
    }

    class setup_py {
        <<build_config>>
        +console_script_hyperai : hyperai.cli:main
    }

    hyperai ..> hyperai_cli : reexports main
    setup_py ..> hyperai_cli : console_scripts entry point
Loading

Thay đổi ở cấp độ file

Thay đổi Chi tiết Files
Expose CLI entry point qua public API của package.
  • Import hàm main của CLI từ module cli mới vào namespace của package.
  • Thêm symbol main vào all để nó được export công khai.
src/hyperai/__init__.py
Sửa và trỏ lại console_scripts entry point tới implementation CLI mới.
  • Đổi target console_scripts từ src.hyperai:main sang hyperai.cli:main để lệnh hyperai đã cài đặt gọi đúng module.
setup.py
Giới thiệu một hyperai CLI cơ bản với các lệnh version và info.
  • Tạo một module cli định nghĩa entry point main(argv: list[str] | None = None) -> int.
  • Implement helper _get_version() sử dụng importlib.metadata để lấy version của package hyperai-framework với fallback an toàn.
  • Dùng argparse để định nghĩa các flag --version (thông qua action="version") và --info, in thông tin về framework khi truyền --info, còn lại thì hiển thị help.
  • Cung cấp một main guard thoát chương trình với mã trả về từ main().
src/hyperai/cli.py

Mẹo và câu lệnh

Tương tác với Sourcery

  • Kích hoạt một lần review mới: Comment @sourcery-ai review trên pull request.
  • Tiếp tục thảo luận: Trả lời trực tiếp vào các comment review của Sourcery.
  • Tạo GitHub issue từ một review comment: Yêu cầu Sourcery tạo issue từ một review comment bằng cách trả lời vào comment đó. Bạn cũng có thể trả lời comment review với @sourcery-ai issue để tạo issue từ comment đó.
  • Tạo tiêu đề pull request: Viết @sourcery-ai ở bất kỳ đâu trong tiêu đề pull request để tạo tiêu đề bất kỳ lúc nào. Bạn cũng có thể comment @sourcery-ai title trên pull request để (tái) tạo tiêu đề bất kỳ lúc nào.
  • Tạo tóm tắt pull request: Viết @sourcery-ai summary ở bất kỳ đâu trong nội dung pull request để tạo tóm tắt PR ngay tại vị trí bạn muốn. Bạn cũng có thể comment @sourcery-ai summary trên pull request để (tái) tạo tóm tắt bất kỳ lúc nào.
  • Tạo reviewer's guide: Comment @sourcery-ai guide trên pull request để (tái) tạo reviewer's guide bất kỳ lúc nào.
  • Resolve tất cả comment của Sourcery: Comment @sourcery-ai resolve trên pull request để resolve tất cả comment của Sourcery. Hữu ích nếu bạn đã xử lý hết comment và không muốn thấy chúng nữa.
  • Dismiss tất cả review của Sourcery: Comment @sourcery-ai dismiss trên pull request để dismiss tất cả review hiện có của Sourcery. Đặc biệt hữu ích nếu bạn muốn bắt đầu lại với một lần review mới – đừng quên comment @sourcery-ai review để kích hoạt review mới!

Tùy chỉnh trải nghiệm của bạn

Truy cập dashboard để:

  • Bật hoặc tắt các tính năng review như tóm tắt pull request do Sourcery tạo, reviewer's guide, và các tính năng khác.
  • Thay đổi ngôn ngữ review.
  • Thêm, xóa hoặc chỉnh sửa các hướng dẫn review tùy chỉnh.
  • Điều chỉnh các thiết lập review khác.

Nhận hỗ trợ

Original review guide in English

Reviewer's Guide

Adds a minimal command-line interface for the hyperai package, wires it up as the console_scripts entry point, and exposes the CLI main() function via the package’s public API.

Sequence diagram for hyperai CLI invocation flow

sequenceDiagram
    actor User
    participant Shell
    participant ConsoleScriptsEntryPoint as console_scripts_entry_point
    participant HyperaiCli as hyperai_cli_main
    participant Argparse
    participant ImportlibMetadata as importlib_metadata

    User->>Shell: hyperai --info
    Shell->>ConsoleScriptsEntryPoint: invoke hyperai
    ConsoleScriptsEntryPoint->>HyperaiCli: main(argv)
    HyperaiCli->>Argparse: ArgumentParser.parse_args(argv)
    Argparse-->>HyperaiCli: args
    alt args.version requested
        HyperaiCli->>ImportlibMetadata: version(hyperai-framework)
        ImportlibMetadata-->>HyperaiCli: version string or PackageNotFoundError
        HyperaiCli-->>User: prints version
    else args.info is True
        HyperaiCli-->>User: prints framework information
    else no flags
        HyperaiCli->>Argparse: print_help()
        Argparse-->>User: help text
    end
    HyperaiCli-->>ConsoleScriptsEntryPoint: return 0
    ConsoleScriptsEntryPoint-->>Shell: process exit 0
Loading

Updated class diagram for hyperai CLI exposure and entry point

classDiagram
    class hyperai {
        <<module>>
        +main(argv list[str] or None) int
    }

    class hyperai_cli {
        <<module>>
        +main(argv list[str] or None) int
        -_get_version() str
    }

    class setup_py {
        <<build_config>>
        +console_script_hyperai : hyperai.cli:main
    }

    hyperai ..> hyperai_cli : reexports main
    setup_py ..> hyperai_cli : console_scripts entry point
Loading

File-Level Changes

Change Details Files
Expose CLI entry point via the package public API.
  • Import the CLI main function from the new cli module into the package namespace.
  • Add the main symbol to all so it is publicly exported.
src/hyperai/__init__.py
Fix and re-point the console_scripts entry point to the new CLI implementation.
  • Change the console_scripts target from src.hyperai:main to hyperai.cli:main so the installed hyperai command invokes the correct module.
setup.py
Introduce a basic hyperai CLI with version and info commands.
  • Create a cli module that defines a main(argv: list[str]
None = None) -> int entry point.
  • Implement _get_version() helper using importlib.metadata to resolve the hyperai-framework package version with a safe fallback.
  • Use argparse to define --version (via action="version") and --info flags, printing framework information when --info is passed and otherwise showing help.
  • Provide a main guard that exits with the return code of main().

  • Tips and commands

    Interacting with Sourcery

    • Trigger a new review: Comment @sourcery-ai review on the pull request.
    • Continue discussions: Reply directly to Sourcery's review comments.
    • Generate a GitHub issue from a review comment: Ask Sourcery to create an
      issue from a review comment by replying to it. You can also reply to a
      review comment with @sourcery-ai issue to create an issue from it.
    • Generate a pull request title: Write @sourcery-ai anywhere in the pull
      request title to generate a title at any time. You can also comment
      @sourcery-ai title on the pull request to (re-)generate the title at any time.
    • Generate a pull request summary: Write @sourcery-ai summary anywhere in
      the pull request body to generate a PR summary at any time exactly where you
      want it. You can also comment @sourcery-ai summary on the pull request to
      (re-)generate the summary at any time.
    • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
      request to (re-)generate the reviewer's guide at any time.
    • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
      pull request to resolve all Sourcery comments. Useful if you've already
      addressed all the comments and don't want to see them anymore.
    • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
      request to dismiss all existing Sourcery reviews. Especially useful if you
      want to start fresh with a new review - don't forget to comment
      @sourcery-ai review to trigger a new review!

    Customizing Your Experience

    Access your dashboard to:

    • Enable or disable review features such as the Sourcery-generated pull request
      summary, the reviewer's guide, and others.
    • Change the review language.
    • Add, remove or edit custom review instructions.
    • Adjust other review settings.

    Getting Help

    Copy link
    Copy Markdown
    Collaborator Author

    @NguyenCuong1989 NguyenCuong1989 left a comment

    Choose a reason for hiding this comment

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

    Ok

    @NguyenCuong1989 NguyenCuong1989 marked this pull request as ready for review February 10, 2026 17:51
    @qodo-code-review
    Copy link
    Copy Markdown

    qodo-code-review Bot commented Feb 10, 2026

    PR Compliance Guide 🔍

    Below is a summary of compliance checks for this PR:

    Security Compliance
    🟢
    No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
    Ticket Compliance
    🎫 No ticket provided
    • Create ticket/issue
    Codebase Duplication Compliance
    Codebase context is not defined

    Follow the guide to enable codebase context checks.

    Custom Compliance
    🟢
    Generic: Comprehensive Audit Trails

    Objective: To create a detailed and reliable record of critical system actions for security analysis
    and compliance.

    Status: Passed

    Learn more about managing compliance generic rules or creating your own custom rules

    Generic: Meaningful Naming and Self-Documenting Code

    Objective: Ensure all identifiers clearly express their purpose and intent, making code
    self-documenting

    Status: Passed

    Learn more about managing compliance generic rules or creating your own custom rules

    Generic: Secure Error Handling

    Objective: To prevent the leakage of sensitive system information through error messages while
    providing sufficient detail for internal debugging.

    Status: Passed

    Learn more about managing compliance generic rules or creating your own custom rules

    Generic: Secure Logging Practices

    Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
    information like PII, PHI, or cardholder data.

    Status: Passed

    Learn more about managing compliance generic rules or creating your own custom rules

    Generic: Security-First Input Validation and Data Handling

    Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
    vulnerabilities

    Status: Passed

    Learn more about managing compliance generic rules or creating your own custom rules

    Generic: Robust Error Handling and Edge Case Management

    Objective: Ensure comprehensive error handling that provides meaningful context and graceful
    degradation

    Status:
    Silent version fallback: The CLI silently falls back to returning "0.0.0" when importlib.metadata cannot
    find the hyperai-framework distribution, which may hide packaging/configuration errors and
    mislead users about the actual installed version.

    Referred Code
    def _get_version() -> str:
        try:
            return metadata.version("hyperai-framework")
        except metadata.PackageNotFoundError:
            return "0.0.0"

    Learn more about managing compliance generic rules or creating your own custom rules

    • Update
    Compliance status legend 🟢 - Fully Compliant
    🟡 - Partial Compliant
    🔴 - Not Compliant
    ⚪ - Requires Further Human Verification
    🏷️ - Compliance label

    Copy link
    Copy Markdown

    @sourcery-ai sourcery-ai Bot left a comment

    Choose a reason for hiding this comment

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

    Hey - tôi đã tìm thấy 1 vấn đề và để lại một số phản hồi tổng quan:

    • Helper _get_version() đang hard-code tên distribution "hyperai-framework"; hãy cân nhắc lấy giá trị này từ metadata của gói đã cài đặt (ví dụ: dùng cùng tên như trong setup.py hoặc qua __package__) để đảm bảo phiên bản CLI luôn đồng bộ nếu tên project thay đổi.
    • Việc export main từ package cấp cao nhất hyperai thông qua __all__ có thể làm "ô nhiễm" API public một cách không cần thiết và tiềm ẩn nguy cơ xung đột tên; bạn có thể chỉ giữ entry point là hyperai.cli:main và tránh re-export nó từ __init__.py.
    Prompt dành cho AI Agents
    Please address the comments from this code review:
    
    ## Overall Comments
    - The `_get_version()` helper hardcodes the distribution name `"hyperai-framework"`; consider deriving this from the installed package metadata (e.g., using the same name as in `setup.py` or via `__package__`) so the CLI version stays in sync if the project name changes.
    - Exporting `main` from the top-level `hyperai` package via `__all__` may unnecessarily pollute the public API and risk name clashes; you could leave the entry point as `hyperai.cli:main` only and avoid re-exporting it from `__init__.py`.
    
    ## Individual Comments
    
    ### Comment 1
    <location> `src/hyperai/cli.py:11-13` </location>
    <code_context>
    +from importlib import metadata
    +
    +
    +def _get_version() -> str:
    +    try:
    +        return metadata.version("hyperai-framework")
    +    except metadata.PackageNotFoundError:
    +        return "0.0.0"
    </code_context>
    
    <issue_to_address>
    **issue (bug_risk):** The hard-coded distribution name in _get_version may not match the actual installed package.
    
    `metadata.version("hyperai-framework")` assumes the distribution name is exactly `hyperai-framework`. If the published package name differs (e.g. `hyperai`), `--version` will always return `0.0.0` even when installed. Consider deriving this from the actual distribution name (e.g. shared constant or setup/pyproject metadata) so they can’t diverge.
    </issue_to_address>

    Sourcery miễn phí cho mã nguồn mở - nếu bạn thấy review này hữu ích, hãy cân nhắc chia sẻ ✨
    Hãy giúp tôi hữu ích hơn! Vui lòng bấm 👍 hoặc 👎 trên từng bình luận và tôi sẽ dùng phản hồi đó để cải thiện các review sau.
    Original comment in English

    Hey - I've found 1 issue, and left some high level feedback:

    • The _get_version() helper hardcodes the distribution name "hyperai-framework"; consider deriving this from the installed package metadata (e.g., using the same name as in setup.py or via __package__) so the CLI version stays in sync if the project name changes.
    • Exporting main from the top-level hyperai package via __all__ may unnecessarily pollute the public API and risk name clashes; you could leave the entry point as hyperai.cli:main only and avoid re-exporting it from __init__.py.
    Prompt for AI Agents
    Please address the comments from this code review:
    
    ## Overall Comments
    - The `_get_version()` helper hardcodes the distribution name `"hyperai-framework"`; consider deriving this from the installed package metadata (e.g., using the same name as in `setup.py` or via `__package__`) so the CLI version stays in sync if the project name changes.
    - Exporting `main` from the top-level `hyperai` package via `__all__` may unnecessarily pollute the public API and risk name clashes; you could leave the entry point as `hyperai.cli:main` only and avoid re-exporting it from `__init__.py`.
    
    ## Individual Comments
    
    ### Comment 1
    <location> `src/hyperai/cli.py:11-13` </location>
    <code_context>
    +from importlib import metadata
    +
    +
    +def _get_version() -> str:
    +    try:
    +        return metadata.version("hyperai-framework")
    +    except metadata.PackageNotFoundError:
    +        return "0.0.0"
    </code_context>
    
    <issue_to_address>
    **issue (bug_risk):** The hard-coded distribution name in _get_version may not match the actual installed package.
    
    `metadata.version("hyperai-framework")` assumes the distribution name is exactly `hyperai-framework`. If the published package name differs (e.g. `hyperai`), `--version` will always return `0.0.0` even when installed. Consider deriving this from the actual distribution name (e.g. shared constant or setup/pyproject metadata) so they can’t diverge.
    </issue_to_address>

    Sourcery is free for open source - if you like our reviews please consider sharing them ✨
    Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

    Comment thread src/hyperai/cli.py Outdated
    @qodo-code-review
    Copy link
    Copy Markdown

    qodo-code-review Bot commented Feb 10, 2026

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    General
    Fallback to library __version__
    Suggestion Impact:The CLI was changed to use the library's imported __version__ for version output, eliminating the previous hardcoded "0.0.0" fallback (and removing the metadata-based _get_version helper entirely).

    code diff:

    -from importlib import metadata
    +
    +from . import __version__
     
     
    -def _get_version() -> str:
    -    try:
    -        return metadata.version("hyperai-framework")
    -    except metadata.PackageNotFoundError:
    -        return "0.0.0"
    -
    -
    -def main(argv: list[str] | None = None) -> int:
    +def main() -> int:
    +    """Entry point for the `hyperai` CLI."""
         parser = argparse.ArgumentParser(
             prog="hyperai",
    -        description="HYPERAI Framework command-line interface.",
    +        description="HYPERAI framework command-line interface.",
         )
         parser.add_argument(
             "--version",
    -        action="version",
    -        version=f"hyperai {_get_version()}",
    +        action="store_true",
    +        help="Show the HYPERAI version and exit.",
         )
    -    parser.add_argument(
    -        "--info",
    -        action="store_true",
    -        help="Show basic framework information.",
    -    )
    -    args = parser.parse_args(argv)
    +    args = parser.parse_args()
     
    -    if args.info:
    -        print("HYPERAI Framework (DAIOF)")
    -        print("A framework for creating self-evolving, self-maintaining AI entities.")
    +    if args.version:
    +        print(__version__)
             return 0

    In src/hyperai/cli.py, modify _get_version() to fall back to the package's
    version constant instead of a hardcoded "0.0.0" when the package is not
    found.

    src/hyperai/cli.py [11-15]

     def _get_version() -> str:
         try:
             return metadata.version("hyperai-framework")
         except metadata.PackageNotFoundError:
    -        return "0.0.0"
    +        # fall back to the library’s own version if not installed
    +        from . import __version__ as local_version
    +        return local_version

    [Suggestion processed]

    Suggestion importance[1-10]: 7

    __

    Why: This is a valuable improvement for development workflows, ensuring the CLI reports the correct version from the source code even when the package is not installed.

    Medium
    Explicitly pass command-line arguments to main

    In src/hyperai/cli.py, modify the if name == "main" block to explicitly
    pass sys.argv[1:] to the main function for better clarity and reusability.

    src/hyperai/cli.py [18-45]

     def main(argv: list[str] | None = None) -> int:
         parser = argparse.ArgumentParser(
             prog="hyperai",
             description="HYPERAI Framework command-line interface.",
         )
         parser.add_argument(
             "--version",
             action="version",
             version=f"hyperai {_get_version()}",
         )
         parser.add_argument(
             "--info",
             action="store_true",
             help="Show basic framework information.",
         )
         args = parser.parse_args(argv)
     
         if args.info:
             print("HYPERAI Framework (DAIOF)")
             print("A framework for creating self-evolving, self-maintaining AI entities.")
             return 0
     
         parser.print_help()
         return 0
     
     
     if __name__ == "__main__":
    -    raise SystemExit(main())
    +    import sys
     
    +    sys.exit(main(sys.argv[1:]))
    +
    • Apply / Chat
    Suggestion importance[1-10]: 6

    __

    Why: The suggestion correctly identifies a best practice for CLI entry points by making the handling of sys.argv explicit, which improves code clarity and reusability.

    Low
    Defer version lookup for better performance
    Suggestion Impact:The commit reworked --version handling to avoid calling _get_version()/importlib.metadata entirely, instead using a boolean flag and printing an imported __version__ only when requested, achieving deferred/cheaper version resolution via a different approach than the suggested lazy __str__ class.

    code diff:

    -from importlib import metadata
    +
    +from . import __version__
     
     
    -def _get_version() -> str:
    -    try:
    -        return metadata.version("hyperai-framework")
    -    except metadata.PackageNotFoundError:
    -        return "0.0.0"
    -
    -
    -def main(argv: list[str] | None = None) -> int:
    +def main() -> int:
    +    """Entry point for the `hyperai` CLI."""
         parser = argparse.ArgumentParser(
             prog="hyperai",
    -        description="HYPERAI Framework command-line interface.",
    +        description="HYPERAI framework command-line interface.",
         )
         parser.add_argument(
             "--version",
    -        action="version",
    -        version=f"hyperai {_get_version()}",
    +        action="store_true",
    +        help="Show the HYPERAI version and exit.",
         )
    -    parser.add_argument(
    -        "--info",
    -        action="store_true",
    -        help="Show basic framework information.",
    -    )
    -    args = parser.parse_args(argv)
    +    args = parser.parse_args()
     
    -    if args.info:
    -        print("HYPERAI Framework (DAIOF)")
    -        print("A framework for creating self-evolving, self-maintaining AI entities.")
    +    if args.version:
    +        print(__version__)
             return 0

    In src/hyperai/cli.py, defer the execution of _get_version() by using a class
    with a str method for the version argument in argparse to improve
    performance.

    src/hyperai/cli.py [23-27]

    +class _LazyVersion:
    +    def __str__(self) -> str:
    +        return f"hyperai {_get_version()}"
    +
    +
    +...
     parser.add_argument(
         "--version",
         action="version",
    -    version=f"hyperai {_get_version()}",
    +    version=_LazyVersion(),
     )

    [To ensure code accuracy, apply this suggestion manually]

    Suggestion importance[1-10]: 3

    __

    Why: The suggestion provides a valid micro-optimization to defer version lookup, but the performance gain is likely negligible and comes at the cost of increased code complexity.

    Low
    High-level
    CLI lacks meaningful framework functionality

    The new CLI only provides version and static information. It should be enhanced
    with at least one command that utilizes the framework's core features to provide
    actual utility.

    Examples:

    src/hyperai/cli.py [18-41]
    def main(argv: list[str] | None = None) -> int:
        parser = argparse.ArgumentParser(
            prog="hyperai",
            description="HYPERAI Framework command-line interface.",
        )
        parser.add_argument(
            "--version",
            action="version",
            version=f"hyperai {_get_version()}",
        )
    
     ... (clipped 14 lines)

    Solution Walkthrough:

    Before:

    # src/hyperai/cli.py
    def main(argv: list[str] | None = None) -> int:
        parser = argparse.ArgumentParser(...)
        parser.add_argument(
            "--version",
            action="version",
            ...
        )
        parser.add_argument(
            "--info",
            action="store_true",
            ...
        )
        args = parser.parse_args(argv)
    
        if args.info:
            print("HYPERAI Framework...")
            return 0
    
        parser.print_help()
        return 0

    After:

    # src/hyperai/cli.py
    # from .core.haios_runtime import HAIOSRuntime (example import)
    
    def main(argv: list[str] | None = None) -> int:
        parser = argparse.ArgumentParser(...)
        subparsers = parser.add_subparsers(dest="command", help="sub-command help")
    
        # Create a parser for the "run" command
        parser_run = subparsers.add_parser("run", help="Run a basic organism")
        # ... add arguments for the run command ...
    
        args = parser.parse_args(argv)
    
        if args.command == "run":
            print("Initializing and running a simple organism...")
            # runtime = HAIOSRuntime()
            # runtime.start()
            return 0
        # ... other commands or default help ...
        else:
            parser.print_help()
            return 0
    Suggestion importance[1-10]: 5

    __

    Why: The suggestion correctly identifies that the new CLI is a stub, but the PR's stated goal was to provide a "minimal" interface, which it does. This is a valid product enhancement suggestion rather than a fix for a critical code issue.

    Low
    • Update

    @github-actions
    Copy link
    Copy Markdown
    Contributor

    👋 This pull request has been automatically marked as stale because it has not had recent activity.

    What happens next:

    • This PR will be closed in 14 days if no further activity occurs
    • Push new commits or comment to remove the stale label
    • Request a review to keep it active

    Tips to get your PR merged:

    • Ensure all CI checks pass ✅
    • Respond to review comments
    • Rebase on latest main if needed
    • Update documentation if applicable

    Thank you for your contribution! 🙏

    @github-actions github-actions Bot added the stale label Mar 28, 2026
    Copy link
    Copy Markdown

    @chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

    Choose a reason for hiding this comment

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

    💡 Codex Review

    Here are some automated review suggestions for this pull request.

    Reviewed commit: 3fad632f48

    ℹ️ About Codex in GitHub

    Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

    • Open a pull request for review
    • Mark a draft as ready
    • Comment "@codex review".

    If Codex has suggestions, it will comment; otherwise it will react with 👍.

    Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

    Comment thread src/hyperai/cli.py
    @@ -1,4 +1,6 @@
    """Command-line interface for the HYPERAI framework."""
    q"""
    Copy link
    Copy Markdown

    Choose a reason for hiding this comment

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

    P0 Badge Remove invalid docstring prefix that breaks module import

    The new leading q before the triple-quoted docstring makes src/hyperai/cli.py invalid Python syntax, so importing hyperai.cli raises a SyntaxError immediately. Because src/hyperai/__init__.py now imports main from this module, this also breaks import hyperai and the hyperai console entry point in all environments.

    Useful? React with 👍 / 👎.

    @github-actions github-actions Bot removed the stale label Mar 30, 2026
    @github-actions
    Copy link
    Copy Markdown
    Contributor

    👋 This pull request has been automatically marked as stale because it has not had recent activity.

    What happens next:

    • This PR will be closed in 14 days if no further activity occurs
    • Push new commits or comment to remove the stale label
    • Request a review to keep it active

    Tips to get your PR merged:

    • Ensure all CI checks pass ✅
    • Respond to review comments
    • Rebase on latest main if needed
    • Update documentation if applicable

    Thank you for your contribution! 🙏

    @github-actions github-actions Bot added the stale label May 14, 2026
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    1 participant