open-code-review/cmd/opencodereview
chethanuk c973e581ec
Some checks are pending
CI / test (push) Waiting to run
fix(tool): resolve file_read paths against git top-level in monorepos (#309)
* fix(tool): resolve file_read paths against git top-level in monorepos

ocr review from a monorepo subdirectory failed with "file not found" (#287):
git reports diff and `git show HEAD:<path>` paths relative to the repo root,
but RepoDir was scoped to the invocation subdirectory, producing a double
prefix. resolveWorkingDir now anchors RepoDir at `git rev-parse
--show-toplevel` on the review path (requireGit=true); scan keeps the CWD so
its `git ls-files` walk stays scoped.

The top-level lookup uses a stdout-only git helper so stderr notices can't
pollute the path, and fails loudly if --show-toplevel errors or is empty
(e.g. a bare repo) instead of silently reusing the subdirectory. Adds
regression tests for the subdir hoist, the scan-path scoping, git-show
resolution of root-relative paths, and the bare-repo failure.

* docs(rules): document repo-root rule.json resolution in monorepos

Since #287 anchored RepoDir at the git top-level, ocr review from a
monorepo subdirectory loads the repo-root .opencodereview/rule.json
rather than a subdir-local one. Call out this user-visible behavior at
loadProjectRule so the scope change isn't a surprise (review feedback).
2026-07-07 20:06:28 +08:00
..
config_cmd.go fix(tui): persist official-tab models and refine saved secret hint (#260) 2026-07-06 20:38:39 +08:00
config_cmd_test.go feat: add standard MCP tool support (#212) 2026-07-01 19:10:16 +08:00
config_dispatch_test.go test: improve coverage for cmd/opencodereview package from 42% to 70% 2026-06-27 01:47:48 +08:00
emit_run_result_test.go test: improve coverage for cmd/opencodereview package from 42% to 70% 2026-06-27 01:47:48 +08:00
flags.go feat: add standard MCP tool support (#212) 2026-07-01 19:10:16 +08:00
flags_test.go test: improve coverage for cmd/opencodereview package from 42% to 70% 2026-06-27 01:47:48 +08:00
git.go fix(tool): resolve file_read paths against git top-level in monorepos (#309) 2026-07-07 20:06:28 +08:00
git_test.go test: improve coverage for cmd/opencodereview package from 42% to 70% 2026-06-27 01:47:48 +08:00
llm_cmd.go feat(vscode): add full-width BYOK provider config panel (#204) 2026-06-25 10:37:25 +08:00
main.go feat: add ocr scan for full-file code review (#93) 2026-06-24 22:07:25 +08:00
output.go feat(review): add structured category and severity to findings (#311) 2026-07-07 13:08:41 +08:00
output_helpers_test.go test: improve coverage for cmd/opencodereview package from 42% to 70% 2026-06-27 01:47:48 +08:00
output_test.go feat(review): add structured category and severity to findings (#311) 2026-07-07 13:08:41 +08:00
procattr_unix.go feat: add standard MCP tool support (#212) 2026-07-01 19:10:16 +08:00
procattr_windows.go feat: add standard MCP tool support (#212) 2026-07-01 19:10:16 +08:00
provider_cmd.go fix(tui): persist official-tab models and refine saved secret hint (#260) 2026-07-06 20:38:39 +08:00
provider_cmd_test.go fix(tui): persist official-tab models and refine saved secret hint (#260) 2026-07-06 20:38:39 +08:00
provider_tui.go fix(tui): persist official-tab models and refine saved secret hint (#260) 2026-07-06 20:38:39 +08:00
provider_tui_funcs_test.go fix(tui): persist official-tab models and refine saved secret hint (#260) 2026-07-06 20:38:39 +08:00
provider_tui_test.go fix(tui): persist official-tab models and refine saved secret hint (#260) 2026-07-06 20:38:39 +08:00
review_cmd.go fix(tool): resolve file_read paths against git top-level in monorepos (#309) 2026-07-07 20:06:28 +08:00
review_cmd_test.go fix(cli): reject --to without --from in review flags (#151) 2026-06-16 20:26:22 +08:00
rules_cmd.go feat(rules): add ocr rules check command to preview effective rule for a file path 2026-05-26 22:11:39 +08:00
scan_cmd.go feat: add tool_calls field to JSON output (#216) 2026-06-25 13:53:06 +08:00
scan_cmd_test.go test: improve coverage for cmd/opencodereview package from 42% to 70% 2026-06-27 01:47:48 +08:00
shared.go fix(tool): resolve file_read paths against git top-level in monorepos (#309) 2026-07-07 20:06:28 +08:00
shared_test.go fix(tool): resolve file_read paths against git top-level in monorepos (#309) 2026-07-07 20:06:28 +08:00
shell_unix.go feat: add standard MCP tool support (#212) 2026-07-01 19:10:16 +08:00
shell_windows.go feat: add standard MCP tool support (#212) 2026-07-01 19:10:16 +08:00
smallfiles_test.go test: improve coverage for cmd/opencodereview package from 42% to 70% 2026-06-27 01:47:48 +08:00
version.go feat(cli): display GitHub repository URL in version and help output 2026-06-02 22:50:36 +08:00
viewer_cmd.go feat: init 2026-05-20 22:03:52 +08:00