Skip to content

feat(cli): add repo command to lookup OpenAuto repository IDs#3

Merged
kowyo merged 1 commit intomainfrom
feat/repo-command
Jan 22, 2026
Merged

feat(cli): add repo command to lookup OpenAuto repository IDs#3
kowyo merged 1 commit intomainfrom
feat/repo-command

Conversation

@kowyo
Copy link
Member

@kowyo kowyo commented Jan 22, 2026

This PR introduces the command to lookup OpenAuto repository IDs. Closes #2

@gemini-code-assist
Copy link

Summary of Changes

Hello @kowyo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new repo command for the CLI, enabling users to efficiently retrieve OpenAuto repository IDs associated with specific courses. The command supports querying based on a course code and a cultivation plan ID, leveraging a TOML-based lookup table for flexible and prioritized mapping. This addresses a direct request for enhanced course-to-repository identification.

Highlights

  • New CLI Command: A new repo command has been added to the command-line interface.
  • OpenAuto Repository ID Lookup: This new command allows users to look up OpenAuto repository IDs corresponding to specific courses.
  • Configurable Mapping: The lookup mechanism utilizes a lookup_table.toml file for flexible and customizable course-to-repository ID mappings.
  • Prioritized Lookup Logic: The repo command employs a specific logic to determine the repository ID: it first checks for a mapping specific to the provided plan_id, then falls back to a DEFAULT mapping, and finally returns the course_code itself if no other match is found.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This PR introduces the repo command to look up OpenAuto repository IDs. The changes add the new command to the CLI parser in main.py and implement the lookup logic in a new file, repo.py. The implementation is generally correct, but I have a few suggestions for repo.py to improve robustness and maintainability. These include refining exception handling, simplifying the lookup logic, and adding type hints for better code clarity.

try:
with open(lookup_path, "rb") as f:
return tomllib.load(f)
except Exception as e:

Choose a reason for hiding this comment

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

high

Catching a broad Exception can hide unexpected errors and make debugging harder. It's better to catch more specific exceptions that you expect to handle. In this case, tomllib.load can raise tomllib.TOMLDecodeError, and file operations can raise OSError.

Suggested change
except Exception as e:
except (tomllib.TOMLDecodeError, OSError) as e:

Comment on lines +33 to +43
if course_code not in lookup:
return course_code

mapping = lookup[course_code]

if plan_id in mapping:
return mapping[plan_id]
elif "DEFAULT" in mapping:
return mapping["DEFAULT"]
else:
return course_code

Choose a reason for hiding this comment

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

medium

The logic for finding the repository ID can be simplified and made more concise by using the dict.get() method with default values. This improves readability and maintainability.

Suggested change
if course_code not in lookup:
return course_code
mapping = lookup[course_code]
if plan_id in mapping:
return mapping[plan_id]
elif "DEFAULT" in mapping:
return mapping["DEFAULT"]
else:
return course_code
mapping = lookup.get(course_code)
if not mapping:
return course_code
return mapping.get(plan_id, mapping.get("DEFAULT", course_code))

return course_code


def run(args):

Choose a reason for hiding this comment

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

medium

For better code clarity and maintainability, it's good practice to add type hints to function arguments. The args parameter is an argparse.Namespace object. Using a string for the type hint avoids needing to import argparse just for type checking.

Suggested change
def run(args):
def run(args: "argparse.Namespace"):

@kowyo kowyo merged commit bf579bd into main Jan 22, 2026
2 checks passed
@kowyo kowyo deleted the feat/repo-command branch January 25, 2026 04:33
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.

Add CLI command to lookup repo ID by plan_id and course_code

1 participant