@open-cr-agent/vcs-local 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -93,19 +93,22 @@ export class LocalGitAdapter {
93
93
  // takes their paths; in the workspace, those git tracks or would.
94
94
  async listFiles(dir) {
95
95
  const { root, head } = await this.target();
96
- const inside = relativeInside(root, resolve(root, dir));
96
+ const absolute = resolve(root, dir);
97
+ // relative(), not ===: git names the root with forward slashes on Windows.
98
+ const inside = relative(root, absolute) === "" ? "" : relativeInside(root, absolute);
97
99
  if (inside === undefined)
98
100
  return [];
99
- const prefix = `${inside.split(sep).join("/")}/`;
101
+ const prefix = inside === "" ? "" : `${inside.split(sep).join("/")}/`;
102
+ const pathspec = prefix || ".";
100
103
  const paths = head === undefined
101
- ? (await git(["ls-files", "--cached", "--others", "--exclude-standard", "-z", "--", prefix], {
104
+ ? (await git(["ls-files", "--cached", "--others", "--exclude-standard", "-z", "--", pathspec], {
102
105
  cwd: root,
103
106
  })).split("\0")
104
- : (await git(["ls-tree", "-z", head, "--", prefix], { cwd: root }))
107
+ : (await git(["ls-tree", "-z", head, "--", pathspec], { cwd: root }))
105
108
  .split("\0")
106
109
  .filter((entry) => /^100(644|755) blob /.test(entry))
107
110
  .map((entry) => entry.slice(entry.indexOf("\t") + 1));
108
- const direct = paths.filter((p) => p.startsWith(prefix) && !p.slice(prefix.length).includes("/"));
111
+ const direct = paths.filter((p) => p.length > prefix.length && p.startsWith(prefix) && !p.slice(prefix.length).includes("/"));
109
112
  return [...new Set(direct)].sort();
110
113
  }
111
114
  searchCode(literal) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-cr-agent/vcs-local",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Local git adapter for Open-CR-Agent: working tree, ranges and commits",
5
5
  "keywords": [
6
6
  "code-review",
@@ -37,7 +37,7 @@
37
37
  "!dist/**/*.map"
38
38
  ],
39
39
  "dependencies": {
40
- "@open-cr-agent/core": "0.10.0",
40
+ "@open-cr-agent/core": "0.11.0",
41
41
  "zod": "^4.6.6"
42
42
  },
43
43
  "publishConfig": {