Skip to content

Conversation

@iamralch
Copy link
Contributor

1. High-Level Summary

What changed:
This PR enhances the OpenCode devcontainer feature by integrating the
opencode-gemini-auth plugin. It adds a configuration file, an onCreate
lifecycle hook, updates feature dependencies, and installs the authentication
plugin globally via npm.

Why it changed:
To enable Gemini authentication support out-of-the-box when using the OpenCode
devcontainer feature, providing a smoother developer experience for users who
need Gemini API integration.

2. Detailed Technical Breakdown

2.1 Behavior & Execution Flow

After this change, the OpenCode devcontainer feature:

  1. Installs after both common-utils and node features (ensuring npm is
    available)
  2. During installation, installs opencode-gemini-auth globally via npm
  3. Triggers hooks/on-create.sh when the devcontainer is created
  4. Configures OpenCode to use the opencode-gemini-auth plugin via the new
    opencode.json configuration file

2.2 Key Modifications

File Change
config/opencode.json New configuration file enabling the gemini-auth plugin
devcontainer-feature.json Added Node.js dependency and onCreate hook
hooks/on-create.sh New lifecycle hook script (placeholder)
install.sh Added npm install for opencode-gemini-auth

2.3 Design Considerations

  • Dependency ordering: The feature now explicitly depends on the Node.js
    feature to ensure npm is available before attempting plugin installation
  • Global npm install: The plugin is installed globally to make it available
    system-wide within the container
  • Lifecycle hooks: Using onCreateCommand allows for future extensibility
    of container initialization logic
  • Configuration-driven plugins: The opencode.json file follows OpenCode's
    plugin system, keeping configuration declarative

2.4 Assumptions & Edge Cases

  • Assumes Node.js feature is available: If the Node.js feature fails to
    install, the npm command will fail
  • Network dependency: Plugin installation requires network access during
    container build
  • Whitespace change: The install.sh indentation was changed from spaces
    to tabs, which is a style inconsistency to note
  • Placeholder hook: The on-create.sh script currently only echoes a
    message and may need actual implementation

3. Impact Assessment

  • Functionality: Adds Gemini authentication capability to OpenCode
    installations within devcontainers
  • Performance: Minimal impact; adds one npm package install during build
    time
  • Reliability: Introduces a new external dependency (opencode-gemini-auth)
    which could fail if the package is unavailable or npm registry is unreachable
  • Security: The gemini-auth plugin will handle authentication credentials;
    users should verify the plugin's security practices
  • Developer experience: Improves DX by pre-configuring Gemini authentication
    automatically
  • Maintainability: The onCreate hook provides a clean extension point for
    future initialization logic

@iamralch iamralch self-assigned this Dec 12, 2025
@iamralch iamralch force-pushed the add-opencode-gemini-auth branch 2 times, most recently from e6b80cd to 959e3a0 Compare December 12, 2025 08:08
Add opencode configuration and npm dependency so the gemini auth plugin
is installed with the feature by default. Require the node feature and
run the on-create hook to guarantee npm is present and emit setup status
as the container initializes.

Signed-off-by: Svetlin Ralchev <iamralch@users.noreply.github.com>
@iamralch iamralch force-pushed the add-opencode-gemini-auth branch from 959e3a0 to 80dd1f7 Compare December 12, 2025 09:01
@iamralch iamralch merged commit c83cf50 into main Dec 12, 2025
12 checks passed
@iamralch iamralch deleted the add-opencode-gemini-auth branch December 12, 2025 09:03
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