Description
Tool transcript headers can render the current session/repo root as in ..
Example:
# Final whitespace check before commit in .
$ git diff --check
# List changed files before commit in .
$ git status --short
This looks like a truncated or malformed sentence. The location suffix is useful for meaningful non-root directories, but . adds no information when it only means “current session root”.
Expected behavior:
# Final whitespace check before commit
$ git diff --check
For commands run in a meaningful subdirectory, the suffix should remain:
# Run API tests in apps/api
$ bun test
Likely cause:
In packages/opencode/src/cli/cmd/run/tool.ts, toolPath() returns "." when the formatted path equals process.cwd().
scrollBashStart() checks the raw workdir before formatting:
const wd = p.input.workdir ?? ""
const dir = wd && wd !== "." ? toolPath(wd) : ""
const title = dir && !desc.includes(dir) ? `${desc} in ${dir}` : desc
So an absolute root workdir passes wd !== ".", then toolPath(wd) returns ".", and the rendered title becomes ${desc} in ..
Similar direct in ${toolPath(...)} patterns appear to exist for glob/grep display output and should use the same suppression rule.
Suggested fix:
Suppress root/current-directory display after formatting, not before formatting.
Rule:
- no suffix for missing workdir
- no suffix for
.
- no suffix for absolute paths that normalize to
.
- keep suffix for meaningful relative paths like
apps/api
- keep readable absolute/home-relative paths for external directories
A small shared helper would keep Bash, Glob, and Grep display behavior consistent.
Plugins
none relevant
OpenCode version
dev / current source around packages/opencode/src/cli/cmd/run/tool.ts
Steps to reproduce
- Start opencode from a repository root.
- Trigger a Bash tool call where
workdir is an absolute path equal to the session/repo root.
- Observe the rendered transcript header.
Screenshot and/or share link
Example transcript:
# Final whitespace check before commit in .
$ git diff --check
(no output)
# List changed files before commit in .
$ git status --short
M apps/api/.env.example
M apps/api/README.md
M apps/api/package.json
Operating System
macOS
Terminal
iTerm2
Description
Tool transcript headers can render the current session/repo root as
in ..Example:
This looks like a truncated or malformed sentence. The location suffix is useful for meaningful non-root directories, but
.adds no information when it only means “current session root”.Expected behavior:
For commands run in a meaningful subdirectory, the suffix should remain:
Likely cause:
In
packages/opencode/src/cli/cmd/run/tool.ts,toolPath()returns"."when the formatted path equalsprocess.cwd().scrollBashStart()checks the raw workdir before formatting:So an absolute root workdir passes
wd !== ".", thentoolPath(wd)returns".", and the rendered title becomes${desc} in ..Similar direct
in ${toolPath(...)}patterns appear to exist for glob/grep display output and should use the same suppression rule.Suggested fix:
Suppress root/current-directory display after formatting, not before formatting.
Rule:
..apps/apiA small shared helper would keep Bash, Glob, and Grep display behavior consistent.
Plugins
none relevant
OpenCode version
dev / current source around packages/opencode/src/cli/cmd/run/tool.ts
Steps to reproduce
workdiris an absolute path equal to the session/repo root.Screenshot and/or share link
Example transcript:
Operating System
macOS
Terminal
iTerm2