Skip to content

Conversation

@shuv1337
Copy link
Collaborator

@shuv1337 shuv1337 commented Jan 2, 2026

Summary

Removes the .deps-installed.json marker file mechanism that was dropping files in user project directories, causing confusion for users developing against the opencode repo.

Changes

Refactoring

  • Revert installDependencies() in config.ts to match upstream behavior
  • Skip dependency installation when running locally (Installation.isLocal() check)
  • Remove marker file caching mechanism that created .deps-installed.json in project directories
  • Remove .deps-installed.json from the .gitignore template
  • Remove related test that was specific to marker file behavior

Breaking Changes

None

Testing

Existing tests cover changes. The removed test was specific to the marker file caching mechanism which is no longer used.

Greptile Summary

Reverted the installDependencies() function to match upstream behavior by removing the .deps-installed.json marker file caching mechanism that was creating files in user project directories.

Key Changes:

  • Removed per-directory install locks and marker file tracking
  • Simplified dependency installation to skip when running locally via Installation.isLocal() check
  • Removed .deps-installed.json from .gitignore template
  • Removed corresponding test for marker file creation

Issues Found:

  • Unreachable code on config.ts:183 - the ternary check for Installation.isLocal() is unnecessary since the function returns early when this condition is true

Confidence Score: 4/5

  • This PR is safe to merge with one minor logic issue to address
  • The refactor successfully removes the problematic marker file mechanism and aligns with upstream. However, there's unreachable code that should be cleaned up for correctness. The logic issue doesn't cause runtime errors but represents dead code.
  • Pay attention to packages/opencode/src/config/config.ts - fix the unreachable ternary on line 183

Important Files Changed

Filename Overview
packages/opencode/src/config/config.ts Simplified dependency installation by removing marker file caching and install locks. Contains unreachable code in version selection logic (line 183).
packages/opencode/test/config/config.test.ts Removed test for marker file mechanism which is no longer used.

Sequence Diagram

sequenceDiagram
    participant User
    participant Config
    participant Installation
    participant BunProc
    participant FileSystem

    User->>Config: get()
    Config->>Config: installDependencies(dir)
    
    alt Installation.isLocal() == true
        Config->>Installation: isLocal()
        Installation-->>Config: true
        Config-->>User: return (skip install)
    else Installation.isLocal() == false
        Config->>Installation: isLocal()
        Installation-->>Config: false
        
        Config->>FileSystem: check package.json exists
        alt package.json missing
            Config->>FileSystem: write empty package.json
        end
        
        Config->>FileSystem: check .gitignore exists
        alt .gitignore missing
            Config->>FileSystem: write .gitignore with patterns
        end
        
        Config->>Installation: BASE_VERSION
        Config->>BunProc: add @opencode-ai/plugin@VERSION
        BunProc-->>Config: success/failure
        
        Config->>BunProc: install (additional deps)
        BunProc-->>Config: success/failure
        
        Config-->>User: return
    end
Loading

Revert to upstream behavior for plugin dependency installation:
- Skip dependency installation when running locally (isLocal check)
- Remove marker file caching mechanism that was dropping
  .deps-installed.json in user project directories
- Remove .deps-installed.json from .gitignore template
- Remove related test that was specific to marker file behavior

This fixes user confusion when .deps-installed.json appears in
project directories, matching upstream opencode behavior.
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

await BunProc.run(["add", "@opencode-ai/plugin@" + targetVersion, "--exact"], {
// Use BASE_VERSION for @opencode-ai/plugin since it's published by upstream without our -N suffix
await BunProc.run(
["add", "@opencode-ai/plugin@" + (Installation.isLocal() ? "latest" : Installation.BASE_VERSION), "--exact"],
Copy link

Choose a reason for hiding this comment

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

logic: The ternary Installation.isLocal() ? "latest" : Installation.BASE_VERSION is unreachable since line 169 returns early when Installation.isLocal() is true. Simplify to just use Installation.BASE_VERSION.

Suggested change
["add", "@opencode-ai/plugin@" + (Installation.isLocal() ? "latest" : Installation.BASE_VERSION), "--exact"],
["add", "@opencode-ai/plugin@" + Installation.BASE_VERSION, "--exact"],
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/opencode/src/config/config.ts
Line: 183:183

Comment:
**logic:** The ternary `Installation.isLocal() ? "latest" : Installation.BASE_VERSION` is unreachable since line 169 returns early when `Installation.isLocal()` is true. Simplify to just use `Installation.BASE_VERSION`.

```suggestion
      ["add", "@opencode-ai/plugin@" + Installation.BASE_VERSION, "--exact"],
```

How can I resolve this? If you propose a fix, please make it concise.

Apply Greptile suggestion - the Installation.isLocal() check on line 169
returns early, making the ternary unreachable. Simplify to just use
Installation.BASE_VERSION.
@shuv1337 shuv1337 closed this in 54aa025 Jan 2, 2026
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