missing documentation for how to run TUI from source #3981

Closed
opened 2026-02-16 17:42:10 -05:00 by yindo · 7 comments
Owner

Originally created by @aspiers on GitHub (Dec 29, 2025).

Originally assigned to: @jayair on GitHub.

AFAICS, there is nothing in any of README.md, CONTRIBUTING.md, https://opencode.ai/docs#install etc. explaining how to run OpenCode from source on another repository, i.e. whilst having the working directory be a different repo other than OpenCode itself.

Fixing this is really important if you want more people to help test (and even develop against) the latest development branches.

I spent several few hours bashing my head against this problem. Eventually I searched the OpenCode Discord chat history and found some breadcrumbs to follow which led me to #3764 and then #3778. Unfortunately however neither of those PRs added / updated any docs.

With extra help from OpenCode, I concluded that this approach works and seems to be correct:

# Save the path to the code we want to run OpenCode against
orig_cwd="$(pwd)"

# Now we can switch to the opencode repo...
cd "$OPENCODE_REPO"
# ... and pass the target directory as a parameter to bun:
bun dev "$orig_cwd" "$@"

Is this right?

Originally created by @aspiers on GitHub (Dec 29, 2025). Originally assigned to: @jayair on GitHub. AFAICS, there is nothing in any of `README.md`, `CONTRIBUTING.md`, https://opencode.ai/docs#install etc. explaining how to run OpenCode from source _on another repository_, i.e. whilst having the working directory be a different repo other than OpenCode itself. Fixing this is _really_ important if you want more people to help test (and even develop against) the latest development branches. I spent several few hours bashing my head against this problem. Eventually I searched the OpenCode Discord chat history and found some breadcrumbs to follow which led me to #3764 and then #3778. Unfortunately however neither of those PRs added / updated any docs. With extra help from OpenCode, I concluded that this approach works and seems to be correct: ```bash # Save the path to the code we want to run OpenCode against orig_cwd="$(pwd)" # Now we can switch to the opencode repo... cd "$OPENCODE_REPO" # ... and pass the target directory as a parameter to bun: bun dev "$orig_cwd" "$@" ``` Is this right?
yindo added the docs label 2026-02-16 17:42:10 -05:00
yindo closed this issue 2026-02-16 17:42:10 -05:00
Author
Owner

@rekram1-node commented on GitHub (Dec 29, 2025):

If you wanna run it for a different dir:

bun dev dir

If you just wanna run it in root of opencode repo:

bun dev .

And if you wanna compile it and have a local executable (a localcode if you will):

./packages/opencode/script/build.ts --single

then run like so (for me this is):

./packages/opencode/dist/opencode-darwin-arm64/bin/opencode

@rekram1-node commented on GitHub (Dec 29, 2025): If you wanna run it for a different dir: bun dev `dir` If you just wanna run it in root of opencode repo: bun dev . And if you wanna compile it and have a local executable (a localcode if you will): ./packages/opencode/script/build.ts --single then run like so (for me this is): ./packages/opencode/dist/opencode-darwin-arm64/bin/opencode
Author
Owner

@rekram1-node commented on GitHub (Dec 29, 2025):

I can update docs tho

@rekram1-node commented on GitHub (Dec 29, 2025): I can update docs tho
Author
Owner

@rekram1-node commented on GitHub (Dec 29, 2025):

/oc use docs agent to update CONTRIBUTING.md to include this

@rekram1-node commented on GitHub (Dec 29, 2025): /oc use docs agent to update CONTRIBUTING.md to include this
Author
Owner

@opencode-agent[bot] commented on GitHub (Dec 29, 2025):

Created PR #6405

New%20session%20-%202025-12-29T23%3A03%3A52.145Z
opencode session  |  github run

@opencode-agent[bot] commented on GitHub (Dec 29, 2025): Created PR #6405 <a href="https://opencode.ai/s/cdZdPmOS"><img width="200" alt="New%20session%20-%202025-12-29T23%3A03%3A52.145Z" src="https://social-cards.sst.dev/opencode-share/TmV3IHNlc3Npb24gLSAyMDI1LTEyLTI5VDIzOjAzOjUyLjE0NVo=.png?model=opencode/claude-opus-4-5&version=1.0.208&id=cdZdPmOS" /></a> [opencode session](https://opencode.ai/s/cdZdPmOS)&nbsp;&nbsp;|&nbsp;&nbsp;[github run](/sst/opencode/actions/runs/20584602117)
Author
Owner

@rekram1-node commented on GitHub (Dec 29, 2025):

How is this?

https://github.com/sst/opencode/blob/dev/CONTRIBUTING.md#running-against-a-different-directory

@rekram1-node commented on GitHub (Dec 29, 2025): How is this? https://github.com/sst/opencode/blob/dev/CONTRIBUTING.md#running-against-a-different-directory
Author
Owner

@paralin commented on GitHub (Dec 29, 2025):

I have this: ~/.local/bin/opencode

#!/bin/bash
set -eo pipefail

PROJECT_DIR=$(pwd)
cd ~/repos/opencode
exec bun dev --dir "$PROJECT_DIR" $@

# Proposed alternative syntax: https://github.com/paralin/opencode/commit/81275b1af11ccf51d20578765e2acf1db08caf0d
# exec bun run --cwd packages/opencode --conditions=browser src/index.ts --dir $PROJECT_DIR $@
@paralin commented on GitHub (Dec 29, 2025): I have this: ~/.local/bin/opencode ```bash #!/bin/bash set -eo pipefail PROJECT_DIR=$(pwd) cd ~/repos/opencode exec bun dev --dir "$PROJECT_DIR" $@ # Proposed alternative syntax: https://github.com/paralin/opencode/commit/81275b1af11ccf51d20578765e2acf1db08caf0d # exec bun run --cwd packages/opencode --conditions=browser src/index.ts --dir $PROJECT_DIR $@ ```
Author
Owner

@aspiers commented on GitHub (Jan 1, 2026):

Awesome thanks a lot @rekram1-node!

@aspiers commented on GitHub (Jan 1, 2026): Awesome thanks a lot @rekram1-node!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3981