chatroom-cli 1.51.0 → 1.52.0

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
@@ -27807,8 +27807,9 @@ ${options.prompt}` : options.prompt;
27807
27807
  `);
27808
27808
  break;
27809
27809
  }
27810
+ const resumePromise = waitForResumeOrAbort(session);
27810
27811
  adapter.finish();
27811
- const resumePrompt = await waitForResumeOrAbort(session);
27812
+ const resumePrompt = await resumePromise;
27812
27813
  if (resumePrompt === null || session.aborted) {
27813
27814
  if (session.aborted) {
27814
27815
  exitCode = 1;
@@ -80251,6 +80252,13 @@ async function getCommitsAhead(workingDir) {
80251
80252
  const count3 = parseInt(result.stdout.trim(), 10);
80252
80253
  return Number.isNaN(count3) ? 0 : count3;
80253
80254
  }
80255
+ async function getCommitsBehind(workingDir) {
80256
+ const result = await runGit("rev-list --count HEAD..@{upstream}", workingDir);
80257
+ if ("error" in result)
80258
+ return 0;
80259
+ const count3 = parseInt(result.stdout.trim(), 10);
80260
+ return Number.isNaN(count3) ? 0 : count3;
80261
+ }
80254
80262
  async function getCommitStatusChecks(cwd, ref) {
80255
80263
  const repoSlug = await getOriginRepoSlug(cwd);
80256
80264
  if (!repoSlug)
@@ -80600,6 +80608,14 @@ var init_git_heartbeat = __esm(() => {
80600
80608
  toMutationPartial: (raw) => ({ commitsAhead: raw }),
80601
80609
  defaultValue: 0
80602
80610
  },
80611
+ {
80612
+ key: "commitsBehind",
80613
+ includeInSlim: false,
80614
+ collect: (wd) => getCommitsBehind(wd),
80615
+ toHashable: (raw) => raw,
80616
+ toMutationPartial: (raw) => ({ commitsBehind: raw }),
80617
+ defaultValue: 0
80618
+ },
80603
80619
  {
80604
80620
  key: "remotes",
80605
80621
  includeInSlim: false,
@@ -84750,6 +84766,37 @@ async function gitPull(workingDir) {
84750
84766
  }
84751
84767
  return { status: "available" };
84752
84768
  }
84769
+ async function gitPush(workingDir) {
84770
+ const result = await runGit2("push", workingDir);
84771
+ if ("error" in result) {
84772
+ const message = result.error.message;
84773
+ if (message.includes("no upstream branch")) {
84774
+ return {
84775
+ status: "error",
84776
+ message: "No upstream branch configured. Set upstream with `git push -u`."
84777
+ };
84778
+ }
84779
+ if (message.includes("Authentication failed") || message.includes("could not read")) {
84780
+ return {
84781
+ status: "error",
84782
+ message: "Authentication failed. Run `gh auth status` to check your GitHub credentials."
84783
+ };
84784
+ }
84785
+ return classifyError2(message);
84786
+ }
84787
+ const stderr = result.stderr.trim();
84788
+ if (stderr && !stderr.includes("Everything up-to-date")) {
84789
+ return { status: "available", message: stderr };
84790
+ }
84791
+ return { status: "available" };
84792
+ }
84793
+ async function gitSync(workingDir) {
84794
+ const pullResult = await gitPull(workingDir);
84795
+ if (pullResult.status === "error") {
84796
+ return pullResult;
84797
+ }
84798
+ return gitPush(workingDir);
84799
+ }
84753
84800
  var execAsync4;
84754
84801
  var init_git_writer = __esm(() => {
84755
84802
  execAsync4 = promisify5(exec5);
@@ -84855,6 +84902,20 @@ async function executeLocalAction(action, workingDir) {
84855
84902
  }
84856
84903
  return { success: true, message: result.message ?? "Pull successful" };
84857
84904
  }
84905
+ case "git-push": {
84906
+ const result = await gitPush(workingDir);
84907
+ if (result.status === "error") {
84908
+ return { success: false, error: result.message };
84909
+ }
84910
+ return { success: true, message: result.message ?? "Push successful" };
84911
+ }
84912
+ case "git-sync": {
84913
+ const result = await gitSync(workingDir);
84914
+ if (result.status === "error") {
84915
+ return { success: false, error: result.message };
84916
+ }
84917
+ return { success: true, message: result.message ?? "Sync successful" };
84918
+ }
84858
84919
  default: {
84859
84920
  const _exhaustive = action;
84860
84921
  return { success: false, error: `Unknown action: ${_exhaustive}` };
@@ -85297,6 +85358,9 @@ async function dispatchCommandEvent(ctx, event, tracker) {
85297
85358
  const result = await executeLocalAction(event.action, event.workingDir);
85298
85359
  if (!result.success) {
85299
85360
  console.warn(`[${formatTimestamp()}] ⚠️ Local action failed: ${result.error}`);
85361
+ } else if (event.action === "git-pull" || event.action === "git-push" || event.action === "git-sync" || event.action === "git-discard-all") {
85362
+ ctx.lastPushedGitState.delete(makeGitStateKey(ctx.machineId, event.workingDir));
85363
+ await pushSingleWorkspaceGitState(ctx, event.workingDir);
85300
85364
  }
85301
85365
  tracker.localActionIds.set(eventId, Date.now());
85302
85366
  } else if (eventType === "command.run") {
@@ -86699,4 +86763,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
86699
86763
  });
86700
86764
  program2.parse();
86701
86765
 
86702
- //# debugId=3E031CCB2CBFFA9464756E2164756E21
86766
+ //# debugId=9CDA1F59EFE33D8964756E2164756E21