@agimon-ai/po-git 0.0.0-alpha.214 → 0.0.0-alpha.216

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.
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_gitDependencies = require("../gitDependencies-D8bKxZSc.cjs");
5
+ const require_gitDependencies = require("../gitDependencies-1HXuMSGk.cjs");
6
6
  let _agimon_ai_po_core_platform = require("@agimon-ai/po-core/platform");
7
7
  let _agimon_ai_po_sparo = require("@agimon-ai/po-sparo");
8
8
  let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin");
@@ -1420,7 +1420,17 @@ function createBranchDiff() {
1420
1420
  "--git-path",
1421
1421
  "rebase-apply"
1422
1422
  ]);
1423
- const rebasing = (await Promise.all([rebaseMerge, rebaseApply].map(async (gitPath) => gitPath === void 0 ? false : node_fs_promises.default.access(node_path.default.resolve(root, gitPath)).then(() => true, () => false)))).some(Boolean);
1423
+ let rebase;
1424
+ for (const gitPath of [rebaseMerge, rebaseApply]) {
1425
+ if (gitPath === void 0 || rebase !== void 0) continue;
1426
+ const directory = node_path.default.resolve(root, gitPath);
1427
+ if (!await node_fs_promises.default.access(directory).then(() => true, () => false)) continue;
1428
+ const headName = await node_fs_promises.default.readFile(node_path.default.join(directory, "head-name"), "utf8").then((text) => text.trim().replace(/^refs\/heads\//u, ""), () => "");
1429
+ rebase = {
1430
+ conflicts,
1431
+ ...headName === "" || headName === "detached HEAD" ? {} : { branch: headName }
1432
+ };
1433
+ }
1424
1434
  const upstreamRef = branch === void 0 ? void 0 : await upstreamOf(root, branch);
1425
1435
  let upstream;
1426
1436
  if (upstreamRef !== void 0) {
@@ -1448,7 +1458,7 @@ function createBranchDiff() {
1448
1458
  ...base.ref === void 0 ? {} : { base: base.ref },
1449
1459
  ...truncated ? { truncated: true } : {},
1450
1460
  ...upstream === void 0 ? {} : { upstream },
1451
- ...rebasing ? { rebase: { conflicts } } : {}
1461
+ ...rebase === void 0 ? {} : { rebase }
1452
1462
  },
1453
1463
  summary: {
1454
1464
  repository: true,
@@ -2594,13 +2604,23 @@ const PENDING = {
2594
2604
  rebase: "rebasing…",
2595
2605
  "abort-rebase": "aborting the rebase…"
2596
2606
  };
2597
- /** The error target a failure maps to: a rejected plain push asks for a confirmed lease force. */
2607
+ /**
2608
+ * The error target a failure maps to: a rejected plain push asks for a confirmed lease force, and an
2609
+ * auth or dirty-tree refusal names its code so the bar can offer the matching recovery.
2610
+ */
2598
2611
  function errorTargetFor$1(command, error) {
2599
- if (command.action !== "push") return { action: command.action };
2612
+ const code = error instanceof require_gitDependencies.PoGitExpectedError && (error.code === "auth_failed" || error.code === "worktree_dirty") ? { code: error.code } : {};
2613
+ if (command.action !== "push") return {
2614
+ action: command.action,
2615
+ ...code
2616
+ };
2600
2617
  return error instanceof require_gitDependencies.PoGitExpectedError && error.code === "push_needs_force" && command.force !== true ? {
2601
2618
  action: "push",
2602
2619
  forceRequired: true
2603
- } : { action: "push" };
2620
+ } : {
2621
+ action: "push",
2622
+ ...code
2623
+ };
2604
2624
  }
2605
2625
  function failureText$1(error) {
2606
2626
  if (error instanceof require_gitDependencies.PoGitExpectedError) return error.message.replace(/^\[[a-z_]+\] /u, "").replace("\nRecovery: ", " ");