@hasna/loops 0.3.55 → 0.3.56

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.
package/dist/cli/index.js CHANGED
@@ -6165,7 +6165,7 @@ function buildScriptInventoryReport(store, opts = {}) {
6165
6165
  // package.json
6166
6166
  var package_default = {
6167
6167
  name: "@hasna/loops",
6168
- version: "0.3.55",
6168
+ version: "0.3.56",
6169
6169
  description: "Persistent local loop and workflow runner for deterministic commands and headless AI coding agents",
6170
6170
  type: "module",
6171
6171
  main: "dist/index.js",
@@ -6582,6 +6582,21 @@ function gitRootFor(path) {
6582
6582
  return;
6583
6583
  }
6584
6584
  }
6585
+ function gitCommonDirFor(path) {
6586
+ if (!existsSync4(path))
6587
+ return;
6588
+ try {
6589
+ const raw = execFileSync("git", ["-C", path, "rev-parse", "--git-common-dir"], {
6590
+ encoding: "utf8",
6591
+ stdio: ["ignore", "pipe", "ignore"]
6592
+ }).trim();
6593
+ if (!raw)
6594
+ return;
6595
+ return isAbsolute2(raw) ? raw : resolve2(path, raw);
6596
+ } catch {
6597
+ return;
6598
+ }
6599
+ }
6585
6600
  function prepareWorktreeCommand(plan) {
6586
6601
  const repo = shellQuote2(plan.repoRoot);
6587
6602
  const path = shellQuote2(plan.path);
@@ -6698,6 +6713,7 @@ function worktreePlan(input, seed) {
6698
6713
  root,
6699
6714
  path: worktreePath,
6700
6715
  branch,
6716
+ gitMetadataDir: gitCommonDirFor(repoRoot),
6701
6717
  prepareStep
6702
6718
  };
6703
6719
  }
@@ -6745,6 +6761,10 @@ function agentTarget(input, prompt, role, seed, plan) {
6745
6761
  assertNativeAuthProfileSupport(input, provider);
6746
6762
  const sandbox = input.sandbox ?? (provider === "codewith" || provider === "codex" ? "workspace-write" : provider === "cursor" ? "enabled" : undefined);
6747
6763
  failClosedSandbox(input, provider, sandbox);
6764
+ const addDirs = [...input.addDirs ?? []];
6765
+ if (plan.enabled && plan.gitMetadataDir && (provider === "codewith" || provider === "codex") && sandbox === "workspace-write") {
6766
+ addDirs.push(plan.gitMetadataDir);
6767
+ }
6748
6768
  return {
6749
6769
  type: "agent",
6750
6770
  provider,
@@ -6753,7 +6773,7 @@ function agentTarget(input, prompt, role, seed, plan) {
6753
6773
  model: input.model,
6754
6774
  variant: input.variant,
6755
6775
  agent: input.agent,
6756
- addDirs: input.addDirs,
6776
+ addDirs: addDirs.length ? [...new Set(addDirs)] : undefined,
6757
6777
  authProfile: provider === "codewith" ? authProfileForRole(input, role, seed) : undefined,
6758
6778
  configIsolation: "safe",
6759
6779
  permissionMode: input.permissionMode ?? "bypass",
@@ -5493,7 +5493,7 @@ function enableStartup(result) {
5493
5493
  // package.json
5494
5494
  var package_default = {
5495
5495
  name: "@hasna/loops",
5496
- version: "0.3.55",
5496
+ version: "0.3.56",
5497
5497
  description: "Persistent local loop and workflow runner for deterministic commands and headless AI coding agents",
5498
5498
  type: "module",
5499
5499
  main: "dist/index.js",
package/dist/index.js CHANGED
@@ -5557,6 +5557,21 @@ function gitRootFor(path) {
5557
5557
  return;
5558
5558
  }
5559
5559
  }
5560
+ function gitCommonDirFor(path) {
5561
+ if (!existsSync3(path))
5562
+ return;
5563
+ try {
5564
+ const raw = execFileSync("git", ["-C", path, "rev-parse", "--git-common-dir"], {
5565
+ encoding: "utf8",
5566
+ stdio: ["ignore", "pipe", "ignore"]
5567
+ }).trim();
5568
+ if (!raw)
5569
+ return;
5570
+ return isAbsolute2(raw) ? raw : resolve2(path, raw);
5571
+ } catch {
5572
+ return;
5573
+ }
5574
+ }
5560
5575
  function prepareWorktreeCommand(plan) {
5561
5576
  const repo = shellQuote2(plan.repoRoot);
5562
5577
  const path = shellQuote2(plan.path);
@@ -5673,6 +5688,7 @@ function worktreePlan(input, seed) {
5673
5688
  root,
5674
5689
  path: worktreePath,
5675
5690
  branch,
5691
+ gitMetadataDir: gitCommonDirFor(repoRoot),
5676
5692
  prepareStep
5677
5693
  };
5678
5694
  }
@@ -5720,6 +5736,10 @@ function agentTarget(input, prompt, role, seed, plan) {
5720
5736
  assertNativeAuthProfileSupport(input, provider);
5721
5737
  const sandbox = input.sandbox ?? (provider === "codewith" || provider === "codex" ? "workspace-write" : provider === "cursor" ? "enabled" : undefined);
5722
5738
  failClosedSandbox(input, provider, sandbox);
5739
+ const addDirs = [...input.addDirs ?? []];
5740
+ if (plan.enabled && plan.gitMetadataDir && (provider === "codewith" || provider === "codex") && sandbox === "workspace-write") {
5741
+ addDirs.push(plan.gitMetadataDir);
5742
+ }
5723
5743
  return {
5724
5744
  type: "agent",
5725
5745
  provider,
@@ -5728,7 +5748,7 @@ function agentTarget(input, prompt, role, seed, plan) {
5728
5748
  model: input.model,
5729
5749
  variant: input.variant,
5730
5750
  agent: input.agent,
5731
- addDirs: input.addDirs,
5751
+ addDirs: addDirs.length ? [...new Set(addDirs)] : undefined,
5732
5752
  authProfile: provider === "codewith" ? authProfileForRole(input, role, seed) : undefined,
5733
5753
  configIsolation: "safe",
5734
5754
  permissionMode: input.permissionMode ?? "bypass",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/loops",
3
- "version": "0.3.55",
3
+ "version": "0.3.56",
4
4
  "description": "Persistent local loop and workflow runner for deterministic commands and headless AI coding agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",