Skip to content

Conversation

@iHildy
Copy link
Owner

@iHildy iHildy commented Dec 31, 2025

Summary

  • harden plugin load when command assets are missing
  • export default/alias for broader module resolution
  • add production-like local pack test + prepack build
  • bump version to 0.4.2

Testing

  • bun test

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @iHildy, 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 focuses on enhancing the stability and testability of the "opencode-synced" plugin. It introduces robust error handling for plugin asset loading, improves module export flexibility for broader compatibility, and adds a new local testing workflow that simulates a production installation. These changes collectively aim to make the plugin more resilient and easier to verify before release.

Highlights

  • Plugin Loading Robustness: Improved the plugin loading mechanism to gracefully handle scenarios where command assets might be missing, preventing potential failures.
  • Enhanced Module Resolution: Broadened module resolution by exporting default and aliased plugin entry points, making it easier for consumers to import the module.
  • Production-like Local Testing: Introduced a new local pack test script and a "prepack" build step to enable testing of the packaged artifact in a production-like environment before publishing.
  • Version Update: The project version has been bumped to "0.4.2" to reflect these changes.
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
Contributor

@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 hardens the plugin loading mechanism, improves module compatibility with additional exports, and introduces a new local packing test script. The changes are generally positive and improve the robustness of the project. My feedback focuses on making the new test script more reliable and ensuring that potential errors during plugin loading are not silently ignored, which will improve debuggability.

Comment on lines +20 to +27
import json, re
from pathlib import Path
version = "${VERSION}"
path = Path("${CACHE_DIR}") / "package.json"
text = path.read_text()
deps = dict(re.findall(r'\"([^\\\"]+)\"\\s*:\\s*\"([^\\\"]+)\"', text))
deps["opencode-synced"] = version
path.write_text(json.dumps({"dependencies": deps}, indent=2) + "\\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Using regular expressions to parse and modify a JSON file is brittle and can lead to unexpected behavior. This implementation overwrites the entire package.json with only the dependencies field, which would remove other important fields like name, version, or scripts. A much safer and more robust approach is to use Python's built-in json module to load, modify, and then write back the JSON data. This preserves the original structure of the file while updating the necessary dependency.

import json
from pathlib import Path
version = "${VERSION}"
path = Path("${CACHE_DIR}") / "package.json"
try:
    data = json.loads(path.read_text())
except json.JSONDecodeError:
    data = {}

if "dependencies" not in data:
    data["dependencies"] = {}

data["dependencies"]["opencode-synced"] = version
path.write_text(json.dumps(data, indent=2) + "\n")

frontmatter,
template: body,
});
} catch {}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Swallowing errors with an empty catch block can make debugging very difficult. If a command file fails to load for any reason (e.g., malformed content, read permissions), the error will be silently ignored, and there will be no indication of what went wrong. It is a best practice to at least log the error to provide visibility into such issues.

    } catch (error) {
      console.error(`[opencode-synced] Failed to load command from ${file}:`, error);
    }

@iHildy iHildy merged commit 48a5b43 into main Dec 31, 2025
3 checks passed
@iHildy iHildy deleted the fix/opencode-synced-0.4.2 branch December 31, 2025 08:41
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.

2 participants