poe-code 4.0.37 → 4.0.38

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
@@ -13045,14 +13045,15 @@ function dispatchAction(state, action, confirmed, runtimeHandles, modalRows) {
13045
13045
  return mark(state, 0);
13046
13046
  }
13047
13047
  if (action.destructive === true && !confirmed) {
13048
+ const actionLabel = typeof action.label === "function" ? action.label() : action.label;
13048
13049
  return {
13049
13050
  state: {
13050
13051
  ...state,
13051
13052
  modal: {
13052
13053
  kind: "confirm",
13053
13054
  title: action.destructive ? "Confirm destructive action" : "Confirm action",
13054
- message: `${typeof action.label === "function" ? action.label() : action.label} ${rows.length === 1 ? rows[0].title : `${rows.length} items`}?`,
13055
- confirmLabel: action.destructive ? "Delete" : "Yes",
13055
+ message: `${actionLabel} ${rows.length === 1 ? rows[0].title : `${rows.length} items`}?`,
13056
+ confirmLabel: actionLabel,
13056
13057
  cancelLabel: "Cancel",
13057
13058
  destructive: action.destructive === true,
13058
13059
  action,
@@ -76783,8 +76784,11 @@ function buildPlanExplorerConfig(options) {
76783
76784
  let plans = options.plans;
76784
76785
  let rows = toRows(plans);
76785
76786
  let entryByRowId = toEntryMap(plans);
76787
+ let preserveOrderOnNextRefresh = false;
76786
76788
  async function refresh() {
76787
- plans = await options.onRefresh();
76789
+ const refreshedPlans = await options.onRefresh();
76790
+ plans = preserveOrderOnNextRefresh ? preservePlanOrder(plans, refreshedPlans) : refreshedPlans;
76791
+ preserveOrderOnNextRefresh = false;
76788
76792
  rows = toRows(plans);
76789
76793
  entryByRowId = toEntryMap(plans);
76790
76794
  }
@@ -76797,7 +76801,12 @@ function buildPlanExplorerConfig(options) {
76797
76801
  const entry = getEntry(entryByRowId, ctx.row.id);
76798
76802
  const readiness = entry.readiness === "ready" ? "draft" : "ready";
76799
76803
  await setPlanReadiness(entry.absolutePath, readiness, options.fs);
76800
- await ctx.refresh();
76804
+ preserveOrderOnNextRefresh = true;
76805
+ try {
76806
+ await ctx.refresh();
76807
+ } finally {
76808
+ preserveOrderOnNextRefresh = false;
76809
+ }
76801
76810
  ctx.toast(`Marked ${path91.basename(entry.path)} ${readiness}`, "info");
76802
76811
  }
76803
76812
  },
@@ -76870,6 +76879,7 @@ function buildPlanExplorerConfig(options) {
76870
76879
  },
76871
76880
  {
76872
76881
  id: "delete",
76882
+ accelerator: "x",
76873
76883
  label: "Delete",
76874
76884
  destructive: true,
76875
76885
  handler: async (ctx) => {
@@ -76917,6 +76927,23 @@ function buildPlanExplorerConfig(options) {
76917
76927
  emptyHint: "No plans found"
76918
76928
  });
76919
76929
  }
76930
+ function preservePlanOrder(current, refreshed) {
76931
+ const refreshedByPath = /* @__PURE__ */ new Map();
76932
+ for (const entry of refreshed) {
76933
+ const matches = refreshedByPath.get(entry.absolutePath) ?? [];
76934
+ matches.push(entry);
76935
+ refreshedByPath.set(entry.absolutePath, matches);
76936
+ }
76937
+ const ordered = [];
76938
+ for (const entry of current) {
76939
+ const matches = refreshedByPath.get(entry.absolutePath);
76940
+ const match = matches?.shift();
76941
+ if (match !== void 0) ordered.push(match);
76942
+ }
76943
+ const remaining = new Set(ordered);
76944
+ ordered.push(...refreshed.filter((entry) => !remaining.has(entry)));
76945
+ return ordered;
76946
+ }
76920
76947
  function abbreviateHome(filePath, homeDir) {
76921
76948
  if (homeDir === void 0) return filePath;
76922
76949
  const relative8 = path91.relative(homeDir, filePath);
@@ -152446,7 +152473,7 @@ var init_package2 = __esm({
152446
152473
  "package.json"() {
152447
152474
  package_default2 = {
152448
152475
  name: "poe-code",
152449
- version: "4.0.37",
152476
+ version: "4.0.38",
152450
152477
  description: "CLI tool to configure Poe API for developer workflows.",
152451
152478
  license: "MIT",
152452
152479
  type: "module",