fix: CLI --help trailing newline & headless run in non-git directories#28627
fix: CLI --help trailing newline & headless run in non-git directories#28627sw33tgum wants to merge 2 commits into
Conversation
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: I found some related PRs that address similar issues. Here are the relevant ones (excluding the current PR #28627): Potential Related PRs:
Note: PR #28622 appears to be a recent PR targeting the same |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
Summary
Two bug fixes:
CLI --help lacks trailing newline #28606 —
--helpoutput lacks trailing newline, causing the next shell prompt to appear on the same line. Fixed by ensuringshow()always appendsEOLwhen the output doesn't already end with one.opencode runexits silently with no output in a non-git directory (GLM 5.1) #28605 —opencode runexits silently with no output in a non-git directory. Root cause:Project.fromDirectoryreturns{worktree: "/", sandbox: "/"}when no.gitdirectory is found. This makescontainsPath()treat all files outsidectx.directoryas external, triggeringexternal_directorypermission requests that are auto-rejected in headless mode. Fixed by usingdirectory(the actual working directory) instead of"/"as the project root boundary.Changes
packages/opencode/src/index.ts:show()now ensures trailing newline viaendsWith(EOL)check.packages/opencode/src/project/project.ts:fromDirectoryreturns{worktree: directory, sandbox: directory}instead of{worktree: "/", sandbox: "/"}when no.gitis present.Closes #28606, closes #28605