poe-code 3.0.366 → 3.0.367

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/index.js CHANGED
@@ -64500,17 +64500,20 @@ async function cloneOrUpdate(locator, options) {
64500
64500
  }
64501
64501
  }
64502
64502
  if (locator.ref) {
64503
+ await fetchRef(cacheDir, locator.ref, options);
64503
64504
  await assertExecSuccess(
64504
- await options.exec("git", ["fetch", "origin"], { cwd: cacheDir }),
64505
- "git fetch failed"
64506
- );
64507
- await assertExecSuccess(
64508
- await options.exec("git", ["checkout", "--", locator.ref], { cwd: cacheDir }),
64505
+ await options.exec("git", ["checkout", "FETCH_HEAD", "--"], { cwd: cacheDir }),
64509
64506
  "git checkout failed"
64510
64507
  );
64511
64508
  }
64512
64509
  return cacheDir;
64513
64510
  }
64511
+ async function fetchRef(cacheDir, ref, options) {
64512
+ await assertExecSuccess(
64513
+ await options.exec("git", ["fetch", "origin", "--", ref], { cwd: cacheDir }),
64514
+ "git fetch failed"
64515
+ );
64516
+ }
64514
64517
  async function pathExists10(fs29, target) {
64515
64518
  try {
64516
64519
  await fs29.stat(target);
@@ -64548,12 +64551,17 @@ async function createWritableCheckout(locator, sourceCwd, options) {
64548
64551
  await assertPathHasNoSymbolicLinks2(options.fs, cwd);
64549
64552
  await options.fs.mkdir(path76.dirname(cwd), { recursive: true });
64550
64553
  await assertPathHasNoSymbolicLinks2(options.fs, cwd);
64551
- await assertExecSuccess2(
64552
- await options.exec("git", ["worktree", "add", "--detach", cwd, revision2], {
64553
- cwd: sourceCwd
64554
- }),
64555
- "git worktree add failed"
64556
- );
64554
+ try {
64555
+ await assertExecSuccess2(
64556
+ await options.exec("git", ["worktree", "add", "--detach", cwd, revision2], {
64557
+ cwd: sourceCwd
64558
+ }),
64559
+ "git worktree add failed"
64560
+ );
64561
+ } catch (error3) {
64562
+ await removeCheckout(cwd, sourceCwd, options).catch(() => void 0);
64563
+ throw error3;
64564
+ }
64557
64565
  try {
64558
64566
  await options.fs.mkdir(cwd, { recursive: true });
64559
64567
  } catch (error3) {
@@ -64607,8 +64615,10 @@ import path77 from "node:path";
64607
64615
  async function resolveWorkspace(input, options) {
64608
64616
  const locator = parseLocator(input);
64609
64617
  if (locator.scheme === "local") {
64618
+ const cwd = path77.isAbsolute(locator.path) ? locator.path : path77.resolve(options.baseDir, locator.path);
64619
+ await assertPathExists(options.fs, cwd, cwd, locator);
64610
64620
  return {
64611
- cwd: path77.isAbsolute(locator.path) ? locator.path : path77.resolve(options.baseDir, locator.path),
64621
+ cwd,
64612
64622
  locator
64613
64623
  };
64614
64624
  }
@@ -64619,9 +64629,13 @@ async function resolveWorkspace(input, options) {
64619
64629
  const needsIsolatedCheckout = mode === "edit" || mode === "auto" || mode === "read" && locator.ref !== void 0;
64620
64630
  const cacheLocator = needsIsolatedCheckout ? { ...locator, ref: void 0 } : locator;
64621
64631
  const cacheDir = await cloneOrUpdate(cacheLocator, options);
64632
+ const checkoutLocator = needsIsolatedCheckout && locator.ref !== void 0 ? { ...locator, ref: "FETCH_HEAD" } : locator;
64622
64633
  let writable;
64623
64634
  try {
64624
- writable = needsIsolatedCheckout ? await createWritableCheckout(locator, cacheDir, options) : void 0;
64635
+ if (needsIsolatedCheckout && locator.ref !== void 0) {
64636
+ await fetchRef(cacheDir, locator.ref, options);
64637
+ }
64638
+ writable = needsIsolatedCheckout ? await createWritableCheckout(checkoutLocator, cacheDir, options) : void 0;
64625
64639
  const workspaceRoot = writable?.cwd ?? cacheDir;
64626
64640
  const cwd = locator.subdir ? path77.join(workspaceRoot, locator.subdir) : workspaceRoot;
64627
64641
  await assertPathExists(options.fs, cwd, workspaceRoot, locator);
@@ -139143,7 +139157,7 @@ var init_package2 = __esm({
139143
139157
  "package.json"() {
139144
139158
  package_default2 = {
139145
139159
  name: "poe-code",
139146
- version: "3.0.366",
139160
+ version: "3.0.367",
139147
139161
  description: "CLI tool to configure Poe API for developer workflows.",
139148
139162
  type: "module",
139149
139163
  main: "./dist/index.js",