@locusai/cli 0.22.3 → 0.22.5

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.
Files changed (2) hide show
  1. package/bin/locus.js +41 -13
  2. package/package.json +2 -2
package/bin/locus.js CHANGED
@@ -1037,25 +1037,53 @@ ${yellow2("⚠")} Docker sandbox not available. Install Docker Desktop 4.58+ fo
1037
1037
  function detectContainerWorkdir(sandboxName, hostProjectRoot) {
1038
1038
  const log = getLogger();
1039
1039
  try {
1040
- const containerPath = execSync2(`docker sandbox exec ${sandboxName} pwd`, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], timeout: 5000 }).trim();
1041
- if (!containerPath) {
1042
- log.debug("Container pwd returned empty result");
1043
- return null;
1044
- }
1045
- if (containerPath === hostProjectRoot) {
1046
- log.debug("Container workdir matches host path", { hostProjectRoot });
1047
- return null;
1040
+ execSync2(`docker sandbox exec ${sandboxName} test -d ${JSON.stringify(hostProjectRoot)}`, { stdio: ["pipe", "pipe", "pipe"], timeout: 5000 });
1041
+ log.debug("Container workdir matches host path", { hostProjectRoot });
1042
+ return null;
1043
+ } catch {
1044
+ log.debug("Host path not found in container, probing for mount point...");
1045
+ }
1046
+ try {
1047
+ const raw = execSync2(`docker sandbox exec ${sandboxName} cat /proc/mounts`, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], timeout: 5000 }).trim();
1048
+ if (raw) {
1049
+ const systemPrefixes = ["/proc", "/sys", "/dev"];
1050
+ const candidates = raw.split(`
1051
+ `).map((line) => {
1052
+ const fields = line.split(" ");
1053
+ return fields[1];
1054
+ }).filter((mp) => !!mp && mp !== "/" && !systemPrefixes.some((p) => mp === p || mp.startsWith(`${p}/`)));
1055
+ for (const candidate of candidates) {
1056
+ try {
1057
+ execSync2(`docker sandbox exec ${sandboxName} sh -c "test -d ${JSON.stringify(candidate + "/.git")} || test -f ${JSON.stringify(candidate + "/package.json")}"`, { stdio: ["pipe", "pipe", "pipe"], timeout: 3000 });
1058
+ log.debug("Detected container workdir from mount table", {
1059
+ hostProjectRoot,
1060
+ containerWorkdir: candidate
1061
+ });
1062
+ return candidate;
1063
+ } catch {}
1064
+ }
1048
1065
  }
1049
- log.debug("Detected container workdir differs from host", {
1050
- hostProjectRoot,
1051
- containerWorkdir: containerPath
1066
+ } catch (err) {
1067
+ log.debug("Mount table probe failed", {
1068
+ error: err instanceof Error ? err.message : String(err)
1052
1069
  });
1053
- return containerPath;
1070
+ }
1071
+ try {
1072
+ const gitDir = execSync2(`docker sandbox exec ${sandboxName} sh -c "find / -maxdepth 10 -name .git -type d ! -path '*/proc/*' ! -path '*/sys/*' ! -path '*/dev/*' ! -path '*/node_modules/*' 2>/dev/null | head -1"`, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], timeout: 15000 }).trim();
1073
+ if (gitDir) {
1074
+ const containerPath = gitDir.replace(/\/\.git$/, "") || "/";
1075
+ log.debug("Detected container workdir from .git marker (deep find)", {
1076
+ hostProjectRoot,
1077
+ containerWorkdir: containerPath
1078
+ });
1079
+ return containerPath;
1080
+ }
1054
1081
  } catch (err) {
1055
- log.debug("Container workdir detection via pwd failed", {
1082
+ log.debug("Container workdir detection via deep find failed", {
1056
1083
  error: err instanceof Error ? err.message : String(err)
1057
1084
  });
1058
1085
  }
1086
+ log.debug("Could not detect container workdir, falling back to host path");
1059
1087
  return null;
1060
1088
  }
1061
1089
  function waitForEnter() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locusai/cli",
3
- "version": "0.22.3",
3
+ "version": "0.22.5",
4
4
  "description": "GitHub-native AI engineering assistant",
5
5
  "type": "module",
6
6
  "bin": {
@@ -36,7 +36,7 @@
36
36
  "license": "MIT",
37
37
  "dependencies": {},
38
38
  "devDependencies": {
39
- "@locusai/sdk": "^0.22.3",
39
+ "@locusai/sdk": "^0.22.5",
40
40
  "@types/bun": "latest",
41
41
  "typescript": "^5.8.3"
42
42
  },