@h-rig/runtime 0.0.6-alpha.13 → 0.0.6-alpha.14

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.
@@ -621,10 +621,6 @@ function runBelongsToProject(projectRoot, run, runsDir) {
621
621
  if (recordedProjectRoot) {
622
622
  return resolve3(recordedProjectRoot) === normalizedRoot;
623
623
  }
624
- const projectLocalRunsDir = resolve3(normalizedRoot, ".rig", "runs");
625
- if (isPathWithin(projectLocalRunsDir, resolve3(runsDir))) {
626
- return true;
627
- }
628
624
  const pathFields = [
629
625
  run.worktreePath,
630
626
  run.artifactRoot,
@@ -632,10 +628,20 @@ function runBelongsToProject(projectRoot, run, runsDir) {
632
628
  run.sessionPath,
633
629
  run.sessionLogPath
634
630
  ].filter((value) => typeof value === "string" && value.trim().length > 0);
635
- if (pathFields.length === 0) {
631
+ if (pathFields.length > 0) {
632
+ if (pathFields.some((value) => isPathWithin(normalizedRoot, resolve3(value)))) {
633
+ return true;
634
+ }
635
+ const pointsAtManagedWorkspace = pathFields.some((value) => /(?:^|[/\\])\.worktrees(?:[/\\]|$)/.test(value));
636
+ if (pointsAtManagedWorkspace) {
637
+ return false;
638
+ }
639
+ }
640
+ const projectLocalRunsDir = resolve3(normalizedRoot, ".rig", "runs");
641
+ if (isPathWithin(projectLocalRunsDir, resolve3(runsDir))) {
636
642
  return true;
637
643
  }
638
- return pathFields.some((value) => isPathWithin(normalizedRoot, resolve3(value)));
644
+ return pathFields.length === 0;
639
645
  }
640
646
  function isPathWithin(root, candidate) {
641
647
  const relativePath = relative(root, candidate);