Skip to content

fix: scope opencode server workdir to calycode workspace#190

Merged
MihalyToth20 merged 1 commit intomainfrom
fix/opencode-scoped-workdir
Apr 10, 2026
Merged

fix: scope opencode server workdir to calycode workspace#190
MihalyToth20 merged 1 commit intomainfrom
fix/opencode-scoped-workdir

Conversation

@MihalyToth20
Copy link
Copy Markdown
Collaborator

@MihalyToth20 MihalyToth20 commented Apr 10, 2026

Summary

  • scope OpenCode server/native-host process execution to ~/.calycode/opencode/workspace instead of inheriting arbitrary launcher directories
  • keep direct oc run proxy behavior project-aware by preserving process.cwd() for normal terminal usage
  • add a patch changeset for @calycode/cli documenting the working-directory safety improvement

Validation

  • pnpm --filter @calycode/cli build
  • pnpm --filter @calycode/cli test
  • lsp_diagnostics on packages/cli/src/commands/opencode/implementation.ts

Summary by CodeRabbit

Improvements

  • OpenCode server and native-host processes now use a dedicated workspace directory for better isolation
  • Customize workspace location via the CALY_OPENCODE_WORKDIR environment variable
  • Default workspace at ~/.calycode/opencode/workspace
  • Project-relative working directory maintained for direct CLI proxy usage

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 10, 2026

🦋 Changeset detected

Latest commit: dab4103

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@calycode/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d708cc6c-4084-462d-ab04-1a3d7f5337a1

📥 Commits

Reviewing files that changed from the base of the PR and between 796fa77 and dab4103.

📒 Files selected for processing (2)
  • .changeset/small-apes-bake.md
  • packages/cli/src/commands/opencode/implementation.ts

Walkthrough

A patch release updates the OpenCode command implementation to scope child processes to a dedicated CalyCode workspace directory. The changes introduce directory resolution logic with environment variable precedence and mode-dependent fallbacks, updating process spawning across multiple code paths.

Changes

Cohort / File(s) Summary
Changeset
.changeset/small-apes-bake.md
New patch release metadata documenting workspace directory scoping for OpenCode server and native-host child processes.
OpenCode Implementation
packages/cli/src/commands/opencode/implementation.ts
Extended getSpawnOptions to accept cwd parameter. Added utility functions (getCalycodeOpencodeWorkspaceDir, ensureDirectoryExists, getOpencodeWorkingDir) implementing precedence-based working directory resolution. Updated proxyOpencode, startNativeHost, and serveOpencode to pass resolved working directory to spawned processes with directory creation side effects.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Whiskers twitching with delight,
Workspaces now scoped just right,
Child processes find their home,
In CalyCode's garden they roam,
Precedence logic shines so bright!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix: scope opencode server workdir to calycode workspace' directly and accurately summarizes the main change: scoping OpenCode server process working directories to a dedicated Calycode workspace directory instead of inheriting arbitrary launcher directories.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/opencode-scoped-workdir

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.

@MihalyToth20 MihalyToth20 merged commit 1d8c48c into main Apr 10, 2026
2 checks passed
@MihalyToth20 MihalyToth20 deleted the fix/opencode-scoped-workdir branch April 10, 2026 08:56
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