@sma1lboy/kobe 0.5.4 → 0.5.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.
package/dist/bin/kobed.js CHANGED
@@ -2355,6 +2355,7 @@ var init_env = () => {};
2355
2355
  var exports_repos = {};
2356
2356
  __export(exports_repos, {
2357
2357
  statePath: () => statePath,
2358
+ sameRepoToplevel: () => sameRepoToplevel,
2358
2359
  resolveRepoRoot: () => resolveRepoRoot,
2359
2360
  removeSavedRepo: () => removeSavedRepo,
2360
2361
  normalizeSavedRepos: () => normalizeSavedRepos,
@@ -2381,6 +2382,19 @@ function resolveRepoRoot(absPath) {
2381
2382
  } catch {}
2382
2383
  return top;
2383
2384
  }
2385
+ function sameRepoToplevel(a, b) {
2386
+ if (a === b)
2387
+ return true;
2388
+ const topA = resolveRepoRoot(a);
2389
+ const topB = resolveRepoRoot(b);
2390
+ if (topA === topB)
2391
+ return true;
2392
+ try {
2393
+ return realpathSync(topA) === realpathSync(topB);
2394
+ } catch {
2395
+ return false;
2396
+ }
2397
+ }
2384
2398
  function statePath() {
2385
2399
  return kvStatePath();
2386
2400
  }
@@ -3024,13 +3038,13 @@ class Orchestrator {
3024
3038
  throw new Error("ensureMainTask: repo is required");
3025
3039
  const normalized = resolveRepoRoot(repo);
3026
3040
  const all = this.store.list();
3027
- const candidates = all.filter((t) => t.kind === "main" && (t.repo === normalized || resolveRepoRoot(t.repo) === normalized));
3041
+ const candidates = all.filter((t) => t.kind === "main" && sameRepoToplevel(t.repo, normalized));
3028
3042
  const winner = candidates.find((t) => t.repo === normalized) ?? candidates[0];
3029
3043
  if (winner) {
3030
3044
  for (const dup of candidates) {
3031
3045
  if (dup.id !== winner.id) {
3032
3046
  try {
3033
- await this.deleteTask(dup.id);
3047
+ await this.store.remove(dup.id);
3034
3048
  } catch (err) {
3035
3049
  console.error(`[kobe orchestrator] ensureMainTask: failed to remove duplicate ${dup.id}:`, err);
3036
3050
  }