@locusai/cli 0.22.2 → 0.22.4

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 +21 -22
  2. package/package.json +2 -2
package/bin/locus.js CHANGED
@@ -1040,26 +1040,25 @@ function detectContainerWorkdir(sandboxName, hostProjectRoot) {
1040
1040
  execSync2(`docker sandbox exec ${sandboxName} test -d ${JSON.stringify(hostProjectRoot)}`, { stdio: ["pipe", "pipe", "pipe"], timeout: 5000 });
1041
1041
  log.debug("Container workdir matches host path", { hostProjectRoot });
1042
1042
  return null;
1043
- } catch {}
1043
+ } catch {
1044
+ log.debug("Host path not found in container, probing for mount point...");
1045
+ }
1044
1046
  try {
1045
- const result = execSync2(`docker sandbox exec ${sandboxName} find / -maxdepth 5 -path '*/.locus/config.json' -type f 2>/dev/null`, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], timeout: 15000 }).trim();
1046
- if (result) {
1047
- const configPath = result.split(`
1048
- `)[0].trim();
1049
- const workdir = configPath.replace(/\/.locus\/config\.json$/, "");
1050
- if (workdir) {
1051
- log.debug("Detected container workdir", {
1052
- hostProjectRoot,
1053
- containerWorkdir: workdir
1054
- });
1055
- return workdir;
1056
- }
1047
+ const gitDir = execSync2(`docker sandbox exec ${sandboxName} sh -c "find / -maxdepth 4 -name .git -type d ! -path '*/proc/*' ! -path '*/sys/*' 2>/dev/null | head -1"`, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], timeout: 1e4 }).trim();
1048
+ if (gitDir) {
1049
+ const containerPath = gitDir.replace(/\/\.git$/, "") || "/";
1050
+ log.debug("Detected container workdir from .git marker", {
1051
+ hostProjectRoot,
1052
+ containerWorkdir: containerPath
1053
+ });
1054
+ return containerPath;
1057
1055
  }
1058
1056
  } catch (err) {
1059
- log.debug("Container workdir probe failed", {
1057
+ log.debug("Container workdir detection via .git probe failed", {
1060
1058
  error: err instanceof Error ? err.message : String(err)
1061
1059
  });
1062
1060
  }
1061
+ log.debug("Could not detect container workdir, falling back to host path");
1063
1062
  return null;
1064
1063
  }
1065
1064
  function waitForEnter() {
@@ -13125,11 +13124,17 @@ async function handleCreate(projectRoot) {
13125
13124
  `);
13126
13125
  }
13127
13126
  }
13127
+ const workdir = config.sandbox.containerWorkdir ?? projectRoot;
13128
+ const backup = backupIgnoredFiles(projectRoot);
13129
+ try {
13130
+ await enforceSandboxIgnore(name, projectRoot, config.sandbox.containerWorkdir);
13131
+ } finally {
13132
+ backup.restore();
13133
+ }
13128
13134
  readySandboxes[provider] = name;
13129
13135
  config.sandbox.enabled = true;
13130
13136
  config.sandbox.providers = readySandboxes;
13131
13137
  saveConfig(projectRoot, config);
13132
- const workdir = config.sandbox.containerWorkdir ?? projectRoot;
13133
13138
  await runSandboxSetup(name, projectRoot, workdir);
13134
13139
  process.stderr.write(`
13135
13140
  ${green("✓")} Sandbox mode enabled for ${bold2(provider)}.
@@ -13614,7 +13619,7 @@ function runInteractiveCommand(command, args) {
13614
13619
  child.on("error", () => resolve2(false));
13615
13620
  });
13616
13621
  }
13617
- async function createProviderSandbox(provider, sandboxName, projectRoot, containerWorkdir) {
13622
+ async function createProviderSandbox(provider, sandboxName, projectRoot) {
13618
13623
  try {
13619
13624
  execSync20(`docker sandbox create --name ${sandboxName} claude ${projectRoot}`, {
13620
13625
  stdio: ["pipe", "pipe", "pipe"],
@@ -13627,12 +13632,6 @@ async function createProviderSandbox(provider, sandboxName, projectRoot, contain
13627
13632
  if (provider === "codex") {
13628
13633
  await ensureCodexInSandbox(sandboxName);
13629
13634
  }
13630
- const backup = backupIgnoredFiles(projectRoot);
13631
- try {
13632
- await enforceSandboxIgnore(sandboxName, projectRoot, containerWorkdir);
13633
- } finally {
13634
- backup.restore();
13635
- }
13636
13635
  return true;
13637
13636
  }
13638
13637
  async function ensurePackageManagerInSandbox(sandboxName, pm) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locusai/cli",
3
- "version": "0.22.2",
3
+ "version": "0.22.4",
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.2",
39
+ "@locusai/sdk": "^0.22.4",
40
40
  "@types/bun": "latest",
41
41
  "typescript": "^5.8.3"
42
42
  },