Skip to content

Transfer claude code commands to gemini cli commands - #183

Closed
wewang58 wants to merge 1 commit into
openshift-eng:mainfrom
wewang58:gemini_helper
Closed

wewang58 wants to merge 1 commit into
openshift-eng:mainfrom
wewang58:gemini_helper

Conversation

@wewang58

@wewang58 wewang58 commented Nov 28, 2025

Copy link
Copy Markdown

What this PR does / why we need it:

Automate jira analysis and PR.
/jira:solve OCPBUGS-12345 origin

Which issue(s) this PR fixes:

Special notes for your reviewer:

Add the ai agent for our options

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.

Summary by CodeRabbit

  • Documentation

    • Added setup guide for Gemini CLI integration with step-by-step instructions to make commands available locally.
    • Added detailed guidance on syncing command definitions with recommended workflow and explicit sync steps.
    • Expanded ethical guidelines with stronger guidance and examples, and emphasized performing sync after command changes.
  • Chores

    • Added an automated sync command and helper script to convert and publish command definitions.

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

@openshift-ci
openshift-ci Bot requested review from mrunalp and stleerh November 28, 2025 09:51
@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 28, 2025
@openshift-ci

openshift-ci Bot commented Nov 28, 2025

Copy link
Copy Markdown
Contributor

Hi @wewang58. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@coderabbitai

coderabbitai Bot commented Nov 28, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Adds Gemini CLI synchronization: documentation updates in README.md and AGENTS.md, a Makefile target sync-gemini, and a new script scripts/sync_gemini_commands.py that converts Claude-formatted Markdown command files into Gemini TOML command files under .gemini/commands/.

Changes

Cohort / File(s) Change Summary
Documentation
README.md, AGENTS.md
README: added "Using Gemini Cli" setup instructions. AGENTS.md: added "Syncing Gemini CLI Commands" guidance (duplicated in two locations), added Gemini sync to Best Practices as item 8, and expanded Ethical Guidelines to emphasize never referencing real people.
Build and Tooling
Makefile, scripts/sync_gemini_commands.py
Makefile: new sync-gemini phony target that runs python3 scripts/sync_gemini_commands.py. Script: scripts/sync_gemini_commands.py added—parses YAML front-matter and Markdown sections from plugins/*/commands/*.md, converts content and performs substitutions (e.g., "Claude" → "Gemini"), and writes TOML files to .gemini/commands/<plugin>/<command>.toml; creates directories and logs outputs.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Dev as Developer (Makefile)
participant Sync as sync_gemini_commands.py
participant Src as plugins//commands/.md
participant Dest as .gemini/commands/*.toml
Dev->>Sync: invoke python3 scripts/sync_gemini_commands.py
Sync->>Src: traverse and read each *.md
Sync->>Sync: parse YAML front-matter and Markdown sections
Sync->>Sync: convert text (Claude→Gemini, path tweaks), build TOML payload
Sync->>Dest: create dirs as needed and write .toml files
Sync->>Dev: log generated file paths

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 warning)
Check name Status Explanation Resolution
No Assumed Git Remote Names ❌ Error The /jira:solve command hardcodes 'origin' remote without verifying it exists or following discovery-first principles. Add git remote verification before use, update documentation to require remote discovery first, or implement dynamic default remote detection.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: transferring Claude code commands to Gemini CLI commands through a new synchronization mechanism, which aligns with all file changes.
No Real People Names In Style References ✅ Passed Comprehensive search of all modified files found no references to real people by name in plugin commands, documentation, prompts, or style references.
Git Push Safety Rules ✅ Passed The pull request does not introduce any git push operations, force push variants, or push workflows in the new code changes.
No Untrusted Mcp Servers ✅ Passed This pull request does not introduce any untrusted MCP server installations. The PR adds documentation and a Python script that performs only local file parsing and conversion operations with no external installations.
✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (2)
README.md (2)

40-44: Specify language for code block and address markdown style issues.

The fenced code block on line 40 is missing a language specifier, and lines 41-43 use dollar signs without context (per MD014 convention, commands should indicate output or use proper context).

Apply this diff to align with markdown best practices:

-```
+```bash
 $ mkdir -p ~/.gemini/commands
 $ git clone git@github.com:openshift-eng/ai-helpers.git
-$ cp -r ./ai-helpers/.gemini/commands/* ~/.gemini/commands/
+$ cp -r ./ai-helpers/.gemini/commands/* ~/.gemini/commands/

This ensures consistent formatting with the "Using Cursor" section above (which also uses bash code blocks).


37-37: Consider using "can" instead of "is able to".

Line 37 uses "is able to find," which can be more concisely expressed as "can find" for better readability.

Apply this diff:

-Gemini cli is able to find the various commands defined in this repo by
+Gemini cli can find the various commands defined in this repo by
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 9d8c2cf and e6cdab0.

📒 Files selected for processing (2)
  • .gemini/commands/jira/solve.toml (1 hunks)
  • README.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md

[style] ~37-~37: As a shorter alternative for ‘able to’, consider using “can”.
Context: ...s ``` ### Using Gemini Cli Gemini cli is able to find the various commands defined in th...

(BE_ABLE_TO)

🪛 markdownlint-cli2 (0.18.1)
README.md

40-40: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


41-41: Dollar signs used before commands without showing output

(MD014, commands-show-output)


42-42: Dollar signs used before commands without showing output

(MD014, commands-show-output)


43-43: Dollar signs used before commands without showing output

(MD014, commands-show-output)

Comment thread .gemini/commands/jira/solve.toml Outdated
- The command uses curl to fetch JIRA data via REST API: https://issues.redhat.com/rest/api/2/issue/{$1}
- Parses JSON response using jq or text processing
- Extracts key fields: summary, description, components, labels
- No authentication required for public Red Hat JIRA issues

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, examine the file context around line 23
cat -n .gemini/commands/jira/solve.toml | head -40

Repository: openshift-eng/ai-helpers

Length of output: 192


🌐 Web query:

Red Hat JIRA authentication requirements public issues

💡 Result:

Short answer: You do not need a Red Hat account to view and search public issues on Red Hat’s Jira (issues.redhat.com). Some projects/pages are public-read only; actions beyond browsing (creating, commenting, or accessing restricted projects) require a Red Hat Customer Portal / SSO account (or Red Hat employee SSO) and follow Red Hat’s authentication (SSO) rules. (spaces.redhat.com)

Citations:


🏁 Script executed:

#!/bin/bash
# Try to search for JIRA-related files and documentation
rg -i "jira" --type toml --type md -A 3 -B 3 2>/dev/null | head -100

Repository: openshift-eng/ai-helpers

Length of output: 192


🌐 Web query:

Red Hat JIRA API authentication required write operations

💡 Result:

Short answer: Yes — any Jira write operation against Red Hat’s Jira (Atlassian Jira) requires an authenticated request. How you authenticate depends on the Jira deployment (Cloud vs Server/Data Center) and the integration type:

What to use

  • Jira Cloud

    • Preferred: API token (use email:APIToken as HTTP Basic auth, Base64-encoded in Authorization: Basic ...). Write calls require authenticated requests. [1][2]
    • Alternative for user-scoped access: OAuth 2.0 (3LO) or OAuth 2.0 service tokens for app integration — ensure you call the correct cloud/external endpoint (api.atlassian.com/ex/jira//...) when using OAuth. [3][4]
  • Jira Server / Data Center

    • Options: Basic auth with username/password (or PAT if enabled), OAuth 1.0(a) application links, or Personal Access Tokens (if your instance supports them). Use the method your admin has enabled. [5]

Implementation notes (common pitfalls)

  • Read-only GETs may work anonymously on some endpoints; any create/update/delete requires authentication and appropriate permissions. [1][5]
  • For file uploads include the required Jira header X-Atlassian-Token: no-check and authenticate the request. [6]
  • If you get “You are not authenticated / Authentication required,” verify: correct auth method for that endpoint (Basic vs OAuth), correct endpoint URL for OAuth tokens, token scope/expiry, and that the authenticating user has permissions. Community guidance and Atlassian docs show Basic+API token is the usual quick fix for write operations on Cloud. [3][4][5]

If you want, tell me: (a) whether your Red Hat Jira is Cloud or Server/DC, and (b) an example request you’re trying — I’ll give the exact curl/headers you need.

Sources:
[1] Jira REST auth docs and examples (python-jira client docs). (jira.readthedocs.io)
[2] Atlassian guidance: use API tokens for Cloud (Basic auth with email:APIToken). (community.atlassian.com)
[3] “Client must be authenticated” and correct api.atlassian.com/ex/jira// URL requirement for OAuth. (community.developer.atlassian.com)
[4] OAuth / OAuth2 integration notes for Jira Server/DC. (confluence.atlassian.com)
[5] Server/DC authentication options and SDK notes (basic, token, oauth). (jira.readthedocs.io)
[6] Attachment upload example requiring X-Atlassian-Token header. (community.atlassian.com)

Citations:


Clarify Red Hat JIRA authentication requirements—write operations require credentials.

The statement "No authentication required for public Red Hat JIRA issues" is incomplete and misleading. While read-only access to public issues does not require authentication, any write operations (creating, updating, or closing issues) require authentication via API token, Basic auth, OAuth, or Personal Access Tokens. Since this command's name ("solve.toml") implies resolving/modifying issues, authentication is necessary. Update the documentation to clarify: (1) read-only access does not require authentication, and (2) any modifications require credentials configured via environment variables (e.g., JIRA_TOKEN) or .netrc.

🤖 Prompt for AI Agents
.gemini/commands/jira/solve.toml around line 23: the current note "No
authentication required for public Red Hat JIRA issues" is incomplete and
misleading for a command that implies modifying issues; update the text to state
that read-only access to public issues requires no auth, but any write
operations (create/update/close) require authentication and specify how to
provide credentials (e.g., JIRA API token, Basic auth, OAuth, or Personal Access
Token via environment variables like JIRA_TOKEN or via .netrc); keep the wording
concise and add a short example pointer to where to configure the token.

Comment thread .gemini/commands/jira/solve.toml Outdated
- Optional
- Steps to reproduce (for bugs)
- Expected vs actual behavior
- Ask the user for further issue grooming if the requried sections are missing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix typo: "requried" → "required".

Line 39 contains a spelling error.

Apply this diff:

-         - Context
-         - Acceptance criteria
-      - Optional
-         - Steps to reproduce (for bugs)
-         - Expected vs actual behavior
-   - Ask the user for further issue grooming if the requried sections are missing
+   - Ask the user for further issue grooming if the required sections are missing
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- Ask the user for further issue grooming if the requried sections are missing
- Ask the user for further issue grooming if the required sections are missing
🤖 Prompt for AI Agents
.gemini/commands/jira/solve.toml around line 39: fix the spelling mistake
"requried" to "required" in the sentence so it reads "Ask the user for further
issue grooming if the required sections are missing"; update only that word and
keep punctuation/spacing unchanged.

Comment thread .gemini/commands/jira/solve.toml Outdated
- **You must ensure verification passes** before proceeding to "Commit Creation"

4. **Commit Creation**:
- Create feature branch using the jira-key $1 as the branch name. For example: "git checkout -b fix-{jira-key}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Clarify git branch naming convention.

Line 79 uses fix-{jira-key} as a placeholder, but earlier lines reference $1 for the JIRA issue key. The placeholder is ambiguous—should this be fix-$1 to match the argument variable naming?

Apply this diff for clarity:

-   - Create feature branch using the jira-key $1 as the branch name. For example: "git checkout -b fix-{jira-key}"
+   - Create feature branch using the jira-key $1 as the branch name. For example: "git checkout -b fix-$1"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- Create feature branch using the jira-key $1 as the branch name. For example: "git checkout -b fix-{jira-key}"
- Create feature branch using the jira-key $1 as the branch name. For example: "git checkout -b fix-$1"
🤖 Prompt for AI Agents
.gemini/commands/jira/solve.toml around line 79: the branch name example uses
the ambiguous placeholder "fix-{jira-key}" while the script earlier uses the
positional argument $1 for the JIRA key; update the example to use the same
variable format (e.g., "git checkout -b fix-$1") so the placeholder matches the
script's argument and remove the curly-braced placeholder to avoid confusion.

Comment thread .gemini/commands/jira/solve.toml Outdated
- Create pull request with:
- Clear title referencing JIRA issue as a prefix. For example: "OCPBUGS-12345: ..."
- The PR description should satisfy the template within .github/PULL_REQUEST_TEMPLATE.md if the file exists
- The "🤖 Generated with Gemini cli" sentence should include a reference to the slash command that triggered the execution, for example "via /jira-solve OCPBUGS-12345 origin"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix command reference: "/jira-solve" → "/jira:solve".

Line 106 references the command as /jira-solve, but the correct syntax per the usage examples is /jira:solve (with a colon, not a dash).

Apply this diff:

-     - The "🤖 Generated with Gemini cli" sentence should include a reference to the slash command that triggered the execution, for example "via /jira-solve OCPBUGS-12345 origin"
+     - The "🤖 Generated with Gemini cli" sentence should include a reference to the slash command that triggered the execution, for example "via /jira:solve OCPBUGS-12345 origin"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- The "🤖 Generated with Gemini cli" sentence should include a reference to the slash command that triggered the execution, for example "via /jira-solve OCPBUGS-12345 origin"
- The "🤖 Generated with Gemini cli" sentence should include a reference to the slash command that triggered the execution, for example "via /jira:solve OCPBUGS-12345 origin"
🤖 Prompt for AI Agents
.gemini/commands/jira/solve.toml around line 106: the generated message
references the slash command as "/jira-solve" but the correct command syntax is
"/jira:solve"; update the sentence to use "/jira:solve" (for example "via
/jira:solve OCPBUGS-12345 origin") so the generated footer correctly matches the
slash command that triggers execution.

@stbenjam

Copy link
Copy Markdown
Member

I am concerned about duplicating a bunch of stuff for both Claude and Gemini that are 99% the same except for formatting. Because we enforce a pretty strict style for our Claude commands, it would probably be scriptable or claudeable to have it migrate everything to gemini commands automatically, so you wouldn't need to try to keep 2 copies of the same instructions.

WDYT?

@stbenjam

Copy link
Copy Markdown
Member

/ok-to-test

@openshift-ci openshift-ci Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 11, 2025
@stbenjam

Copy link
Copy Markdown
Member

If you join the github org your PR's will get tested automatically

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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)
README.md (1)

35-44: LGTM! Clear documentation for Gemini CLI setup.

The new section follows the same pattern as the Cursor integration and provides clear setup instructions.

Optionally, consider this minor style improvement:

-Gemini cli is able to find the various commands defined in this repo by
+Gemini cli can find the various commands defined in this repo by
scripts/sync_gemini_commands.py (1)

143-170: Consider adding error handling for file operations.

The script lacks error handling for file I/O operations. If a markdown file is malformed or cannot be read/written, the script will crash without a helpful error message.

Consider wrapping file operations in try-except blocks:

                    # Read MD
                    try:
                        with open(md_path, 'r') as f:
                            md_content = f.read()
                    except IOError as e:
                        print(f"Error reading {md_path}: {e}")
                        continue
                    
                    # Convert
                    data = parse_markdown_command(md_content)
                    
                    # Ensure directory exists
                    os.makedirs(dest_dir, exist_ok=True)
                    
                    # Write TOML
                    try:
                        with open(dest_file, 'w') as f:
                            f.write(f'description = """{data["description"]}"""\n\n')
                            f.write(f'prompt = """\n{data["prompt"]}\n"""\n')
                        print(f"Generated {dest_file}")
                    except IOError as e:
                        print(f"Error writing {dest_file}: {e}")
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between e6cdab0 and 8e10b48.

📒 Files selected for processing (4)
  • AGENTS.md (2 hunks)
  • Makefile (1 hunks)
  • README.md (1 hunks)
  • scripts/sync_gemini_commands.py (1 hunks)
🧰 Additional context used
🪛 checkmake (0.2.2)
Makefile

[warning] 31-31: Missing required phony target "all"

(minphony)


[warning] 31-31: Missing required phony target "clean"

(minphony)


[warning] 31-31: Missing required phony target "test"

(minphony)

🪛 LanguageTool
README.md

[style] ~37-~37: As a shorter alternative for ‘able to’, consider using “can”.
Context: ...s ``` ### Using Gemini Cli Gemini cli is able to find the various commands defined in th...

(BE_ABLE_TO)

🪛 Ruff (0.14.8)
scripts/sync_gemini_commands.py

125-125: Loop control variable dirs not used within loop body

Rename unused dirs to _dirs

(B007)


151-151: Local variable toml_content is assigned to but never used

Remove assignment to unused variable toml_content

(F841)

🔇 Additional comments (7)
scripts/sync_gemini_commands.py (4)

1-5: LGTM! Appropriate imports for the conversion task.


7-44: LGTM! Solid parsing logic with proper error handling.

The front matter and section extraction logic correctly handles the Markdown structure with appropriate error handling for YAML parsing.


46-80: LGTM! Well-structured conversion logic.

The description extraction and prompt construction appropriately combines the relevant Markdown sections into the Gemini format.


82-88: The "enxebre" → "origin" replacement is intentional and justified—no change needed.

The hardcoded replacement on line 88 is not arbitrary or brittle. "enxebre" is a repository owner (listed in OWNERS file) whose username appears in example command usage (/jira:solve OCPBUGS-12345 enxebre). The replacement converts personal examples to generic ones by substituting with "origin" (a standard git remote reference), which aligns with how command documentation uses "origin" consistently across other files (e.g., plugins/jira/commands/solve.md line 23). This is a documented, one-time pattern conversion as part of the Claude-to-Gemini sync, not a fragile generic text replacement.

Likely an incorrect or invalid review comment.

Makefile (1)

31-35: LGTM! Clean Makefile target integration.

The new sync-gemini target follows the existing pattern and provides clear feedback during execution.

AGENTS.md (2)

288-310: LGTM! Comprehensive documentation for the Gemini sync workflow.

The new section clearly explains when and how to sync Gemini CLI commands, and appropriately emphasizes committing the generated files to keep both formats synchronized.


345-346: LGTM! Appropriate addition to best practices.

Adding the Gemini sync step to the best practices checklist ensures developers remember to keep both command formats in sync.

print(f"Error: {plugins_dir} not found.")
return

for root, dirs, files in os.walk(plugins_dir):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove unused loop variable.

The dirs variable in the os.walk() loop is not used.

Apply this diff:

-    for root, dirs, files in os.walk(plugins_dir):
+    for root, _dirs, files in os.walk(plugins_dir):
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
for root, dirs, files in os.walk(plugins_dir):
for root, _dirs, files in os.walk(plugins_dir):
🧰 Tools
🪛 Ruff (0.14.8)

125-125: Loop control variable dirs not used within loop body

Rename unused dirs to _dirs

(B007)

🤖 Prompt for AI Agents
In scripts/sync_gemini_commands.py around line 125, the os.walk loop declares an
unused variable `dirs`; change the loop to use a throwaway name for that element
(e.g., replace `dirs` with `_`) so only `root` and `files` are used, keeping
semantics the same and eliminating the unused variable warning.

Comment on lines +151 to +154
toml_content = {
"description": data['description'],
"prompt": data['prompt']
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove unused variable.

The toml_content dictionary is created but never used. The code manually formats the TOML output on lines 167-168 instead of using this variable.

Apply this diff to remove the unused variable:

-                    # Prepare TOML content
-                    toml_content = {
-                        "description": data['description'],
-                        "prompt": data['prompt']
-                    }
-                    
                     # Ensure directory exists
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
toml_content = {
"description": data['description'],
"prompt": data['prompt']
}
🧰 Tools
🪛 Ruff (0.14.8)

151-151: Local variable toml_content is assigned to but never used

Remove assignment to unused variable toml_content

(F841)

🤖 Prompt for AI Agents
In scripts/sync_gemini_commands.py around lines 151 to 154, remove the unused
toml_content dictionary creation (the toml_content = { "description":
data['description'], "prompt": data['prompt'] }) since the code manually formats
the TOML output later; delete these lines and ensure no other references to
toml_content remain so the later manual formatting at lines ~167-168 remains the
single source of TOML output.

Comment thread scripts/sync_gemini_commands.py Outdated
@wewang58

wewang58 commented Dec 12, 2025

Copy link
Copy Markdown
Author

I am concerned about duplicating a bunch of stuff for both Claude and Gemini that are 99% the same except for formatting. Because we enforce a pretty strict style for our Claude commands, it would probably be scriptable or claudeable to have it migrate everything to gemini commands automatically, so you wouldn't need to try to keep 2 copies of the same instructions.

WDYT?

@stbenjam Good idea! how about use "make sync-gemini", so it's simple & flexible, it give options for some people can use it.

@wewang58

Copy link
Copy Markdown
Author

@stbenjam Can you help to review my new update? thanks.

@openshift-ci

openshift-ci Bot commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wewang58
Once this PR has been reviewed and has the lgtm label, please assign zaneb for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@wewang58 wewang58 changed the title Add Gemini cli /jira:solve slash command Transfer claude code commands to gemini cli commands Jan 23, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@README.md`:
- Around line 35-44: Update the "Using Gemini Cli" section in README.md: change
the code fence to include a language tag (use "bash"), remove the leading shell
prompt characters ("$") from the three commands so they are plain commands, and
normalize the header capitalization to "Using Gemini CLI" for consistency;
locate the section by the header text "Using Gemini Cli" and update the fenced
block accordingly.

In `@scripts/sync_gemini_commands.py`:
- Around line 117-163: The sync currently only writes/overwrites .toml files but
never removes stale files in gemini_dir, causing orphaned Gemini command files;
update main() to either clear the target directory before regenerating or prune
files not produced: e.g., compute the set of generated dest_file paths while
walking plugins_dir (using plugin_name/command_name logic), then remove any
existing files under gemini_dir that are not in that set (or simpler, if safe,
remove gemini_dir entirely with shutil.rmtree and recreate it before writing).
Ensure you reference and update gems under the existing variables/functions:
plugins_dir, gemini_dir, dest_dir, dest_file, and keep os.makedirs(dest_dir,
exist_ok=True) behavior for generation.

Comment thread README.md
Comment on lines +35 to +44
### Using Gemini Cli

Gemini cli is able to find the various commands defined in this repo by
making it available inside your `~/.gemini/commands` directory.

```
$ mkdir -p ~/.gemini/commands
$ git clone git@github.com:openshift-eng/ai-helpers.git
$ cp -r ./ai-helpers/.gemini/commands/* ~/.gemini/commands/
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add language tag and remove shell prompts in the Gemini CLI snippet.

This block trips markdownlint (MD040/MD014). Also consider consistent “CLI” capitalization.

📝 Proposed doc fix
-### Using Gemini Cli
+### Using Gemini CLI
 
-Gemini cli is able to find the various commands defined in this repo by
+Gemini CLI can find the various commands defined in this repo by
 making it available inside your `~/.gemini/commands` directory.
 
-```
-$ mkdir -p ~/.gemini/commands
-$ git clone git@github.com:openshift-eng/ai-helpers.git
-$ cp -r ./ai-helpers/.gemini/commands/* ~/.gemini/commands/
-```
+```bash
+mkdir -p ~/.gemini/commands
+git clone git@github.com:openshift-eng/ai-helpers.git
+cp -r ./ai-helpers/.gemini/commands/* ~/.gemini/commands/
+```
🧰 Tools
🪛 LanguageTool

[style] ~37-~37: As a shorter alternative for ‘able to’, consider using “can”.
Context: ...s ``` ### Using Gemini Cli Gemini cli is able to find the various commands defined in th...

(BE_ABLE_TO)

🪛 markdownlint-cli2 (0.18.1)

40-40: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


41-41: Dollar signs used before commands without showing output

(MD014, commands-show-output)


42-42: Dollar signs used before commands without showing output

(MD014, commands-show-output)


43-43: Dollar signs used before commands without showing output

(MD014, commands-show-output)

🤖 Prompt for AI Agents
In `@README.md` around lines 35 - 44, Update the "Using Gemini Cli" section in
README.md: change the code fence to include a language tag (use "bash"), remove
the leading shell prompt characters ("$") from the three commands so they are
plain commands, and normalize the header capitalization to "Using Gemini CLI"
for consistency; locate the section by the header text "Using Gemini Cli" and
update the fenced block accordingly.

Comment on lines +117 to +163
def main():
plugins_dir = "plugins"
gemini_dir = ".gemini/commands"

if not os.path.exists(plugins_dir):
print(f"Error: {plugins_dir} not found.")
return

for root, dirs, files in os.walk(plugins_dir):
for file in files:
if file.endswith(".md"):
md_path = os.path.join(root, file)

# Determine relative path structure
# plugins/jira/commands/solve.md -> jira/solve.toml
rel_path = os.path.relpath(md_path, plugins_dir)
path_parts = rel_path.split(os.sep)

# We expect plugins/<plugin_name>/commands/<command_name>.md
if len(path_parts) >= 3 and path_parts[1] == 'commands':
plugin_name = path_parts[0]
command_name = os.path.splitext(path_parts[-1])[0]

dest_dir = os.path.join(gemini_dir, plugin_name)
dest_file = os.path.join(dest_dir, f"{command_name}.toml")

# Read MD
with open(md_path, 'r') as f:
md_content = f.read()

# Convert
data = parse_markdown_command(md_content)

# Prepare TOML content
toml_content = {
"description": data['description'],
"prompt": data['prompt']
}

# Ensure directory exists
os.makedirs(dest_dir, exist_ok=True)

# Write TOML
with open(dest_file, 'w') as f:
toml.dump(toml_content, f)

print(f"Generated {dest_file}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Sync should remove stale Gemini command files.

Right now, deleted/renamed Claude commands leave old .toml files behind, so Gemini commands can drift. Consider clearing the generated directory before regenerating (or pruning files not in the generated set).

🧹 Proposed fix (clear generated outputs)
 import os
 import re
+import shutil
 import toml
 import yaml
@@
 def main():
     plugins_dir = "plugins"
     gemini_dir = ".gemini/commands"
@@
     if not os.path.exists(plugins_dir):
         print(f"Error: {plugins_dir} not found.")
         return
+
+    # Fresh sync to avoid stale Gemini commands
+    if os.path.exists(gemini_dir):
+        shutil.rmtree(gemini_dir)
+    os.makedirs(gemini_dir, exist_ok=True)
 
     for root, dirs, files in os.walk(plugins_dir):
🧰 Tools
🪛 Ruff (0.14.13)

125-125: Loop control variable dirs not used within loop body

Rename unused dirs to _dirs

(B007)

🤖 Prompt for AI Agents
In `@scripts/sync_gemini_commands.py` around lines 117 - 163, The sync currently
only writes/overwrites .toml files but never removes stale files in gemini_dir,
causing orphaned Gemini command files; update main() to either clear the target
directory before regenerating or prune files not produced: e.g., compute the set
of generated dest_file paths while walking plugins_dir (using
plugin_name/command_name logic), then remove any existing files under gemini_dir
that are not in that set (or simpler, if safe, remove gemini_dir entirely with
shutil.rmtree and recreate it before writing). Ensure you reference and update
gems under the existing variables/functions: plugins_dir, gemini_dir, dest_dir,
dest_file, and keep os.makedirs(dest_dir, exist_ok=True) behavior for
generation.

@stbenjam

stbenjam commented Mar 2, 2026

Copy link
Copy Markdown
Member

@wewang58 A lot of slash commands refer to Skills (they are mostly think wrappers around skills, telling claude to use the skill). The latest Gemini CLI seems to support skills, could we migrate those too?

@wewang58 wewang58 closed this Mar 9, 2026
@wewang58 wewang58 reopened this Mar 9, 2026
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 9, 2026
@openshift-merge-robot

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci

openshift-ci Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

@wewang58: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/images 47dd474 link true /test images

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@wewang58

Copy link
Copy Markdown
Author

@stbenjam there's more detail pr for the feature: #369 from @zhfeng, you can review the pr, i will close mine, thanks.

@wewang58 wewang58 closed this Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants