Skip to content

refactor: use args array for opencode launch command#354

Merged
marcusquinn merged 1 commit intomainfrom
refactor/opencode-launch-args
Feb 5, 2026
Merged

refactor: use args array for opencode launch command#354
marcusquinn merged 1 commit intomainfrom
refactor/opencode-launch-args

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Feb 5, 2026

Summary

Addresses Gemini code review suggestion from PR #346. Builds the opencode command arguments dynamically using a bash array instead of duplicating the base command in an if/else block.

Before:

if [[ -n "$onboarding_model" ]]; then
    opencode --agent Onboarding --prompt "/onboarding" --model "$onboarding_model"
else
    opencode --agent Onboarding --prompt "/onboarding"
fi

After:

local opencode_args=("--agent" "Onboarding" "--prompt" "/onboarding")
if [[ -n "$onboarding_model" ]]; then
    opencode_args+=("--model" "$onboarding_model")
fi
opencode "${opencode_args[@]}"

Summary by CodeRabbit

  • Refactor
    • Improved internal argument construction for OpenCode invocation, maintaining existing functionality.

Address Gemini code review suggestion from PR #346 to reduce
duplication by building opencode args dynamically.
@gemini-code-assist
Copy link

Summary of Changes

Hello @marcusquinn, 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 refactors the launch logic for the opencode command within the setup.sh script. The change consolidates the command's arguments into a dynamically built bash array, which addresses a previous code review suggestion by eliminating redundant code and enhancing the clarity of the script.

Highlights

  • Code Refactoring: The opencode command invocation in setup.sh has been refactored to use a bash array for arguments, replacing a conditional if/else block. This improves readability and maintainability by dynamically building the command's arguments.
Changelog
  • setup.sh
    • Refactored the opencode command invocation by replacing a conditional if/else block with a dynamic bash array to construct and pass arguments.
Activity
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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

Walkthrough

The setup.sh script refactors OpenCode invocation to use a dynamic argument array instead of inline arguments. Base arguments are initialized in an opencode_args array, with the model argument conditionally appended only when available. This centralizes argument construction while preserving behavior for non-model scenarios.

Changes

Cohort / File(s) Summary
OpenCode Invocation Refactoring
setup.sh
Refactors argument passing from inline method to a dynamic array-based approach (opencode_args), enabling conditional inclusion of the --model flag when an onboarding model is present. Improves maintainability without altering functional behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🚀 Arguments flow in ordered arrays,
No more inline chaos in shell's ancient ways,
Conditions and models dance in perfect sync,
A refactor refined to the very brink,
DevOps elegance—clean and precise! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main refactoring change: converting to a dynamic argument array for the opencode launch command to eliminate duplication.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/opencode-launch-args

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.

@github-actions
Copy link

github-actions bot commented Feb 5, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 3 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Thu Feb 5 22:55:56 UTC 2026: Code review monitoring started
Thu Feb 5 22:55:57 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 3
Thu Feb 5 22:55:57 UTC 2026: Qlty - 0 issues found, auto-formatting applied
Thu Feb 5 22:55:59 UTC 2026: Codacy analysis completed with auto-fixes

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 3
  • VULNERABILITIES: 0

Generated on: Thu Feb 5 22:56:02 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

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 pull request refactors the construction of the opencode command to use a bash array. This is a good improvement as it eliminates code duplication from the previous if/else block and makes the code more maintainable and extensible for future arguments. The implementation is correct and follows bash best practices for handling command arguments. The changes look good to merge.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 5, 2026

@marcusquinn marcusquinn merged commit 1c6e0a2 into main Feb 5, 2026
11 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.

1 participant

Comments