chatroom-cli 1.38.1 → 1.38.3

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
@@ -75090,8 +75090,8 @@ async function pushSingleWorkspaceGitState(ctx, workingDir) {
75090
75090
  const stateKey = makeGitStateKey(ctx.machineId, workingDir);
75091
75091
  const isRepo = await isGitRepo(workingDir);
75092
75092
  if (!isRepo) {
75093
- const stateHash = "not_found";
75094
- if (ctx.lastPushedGitState.get(stateKey) === stateHash)
75093
+ const stateHash2 = "not_found";
75094
+ if (ctx.lastPushedGitState.get(stateKey) === stateHash2)
75095
75095
  return;
75096
75096
  await ctx.deps.backend.mutation(api.workspaces.upsertWorkspaceGitState, {
75097
75097
  sessionId: ctx.sessionId,
@@ -75099,13 +75099,13 @@ async function pushSingleWorkspaceGitState(ctx, workingDir) {
75099
75099
  workingDir,
75100
75100
  status: "not_found"
75101
75101
  });
75102
- ctx.lastPushedGitState.set(stateKey, stateHash);
75102
+ ctx.lastPushedGitState.set(stateKey, stateHash2);
75103
75103
  return;
75104
75104
  }
75105
75105
  const branchResult = await getBranch(workingDir);
75106
75106
  if (branchResult.status === "error") {
75107
- const stateHash = `error:${branchResult.message}`;
75108
- if (ctx.lastPushedGitState.get(stateKey) === stateHash)
75107
+ const stateHash2 = `error:${branchResult.message}`;
75108
+ if (ctx.lastPushedGitState.get(stateKey) === stateHash2)
75109
75109
  return;
75110
75110
  await ctx.deps.backend.mutation(api.workspaces.upsertWorkspaceGitState, {
75111
75111
  sessionId: ctx.sessionId,
@@ -75114,7 +75114,7 @@ async function pushSingleWorkspaceGitState(ctx, workingDir) {
75114
75114
  status: "error",
75115
75115
  errorMessage: branchResult.message
75116
75116
  });
75117
- ctx.lastPushedGitState.set(stateKey, stateHash);
75117
+ ctx.lastPushedGitState.set(stateKey, stateHash2);
75118
75118
  return;
75119
75119
  }
75120
75120
  if (branchResult.status === "not_found") {
@@ -75125,23 +75125,36 @@ async function pushSingleWorkspaceGitState(ctx, workingDir) {
75125
75125
  const pipeline2 = new GitStatePipeline(allFields);
75126
75126
  const preCollected = new Map([["branch", branchResult]]);
75127
75127
  const values3 = await pipeline2.collect(workingDir, preCollected);
75128
- const commits = values3.get("commits");
75128
+ const commits = await getRecentCommits(workingDir, COMMITS_PER_PAGE);
75129
75129
  const hasMoreCommits = commits.length >= COMMITS_PER_PAGE;
75130
- const hash2 = pipeline2.computeHash(values3, false);
75131
- if (ctx.lastPushedGitState.get(stateKey) === hash2) {
75132
- return;
75130
+ const stateHash = pipeline2.computeHash(values3, false);
75131
+ const commitsKey = `${stateKey}:commits`;
75132
+ const commitsHash = JSON.stringify(commits.map((c) => c.sha));
75133
+ if (ctx.lastPushedGitState.get(stateKey) !== stateHash) {
75134
+ await ctx.deps.backend.mutation(api.workspaces.upsertWorkspaceGitState, {
75135
+ sessionId: ctx.sessionId,
75136
+ machineId: ctx.machineId,
75137
+ workingDir,
75138
+ status: "available",
75139
+ ...pipeline2.toMutationArgs(values3, false)
75140
+ });
75141
+ ctx.lastPushedGitState.set(stateKey, stateHash);
75142
+ console.log(`[${formatTimestamp()}] \uD83D\uDD00 Git state pushed: ${workingDir} (${branch}${values3.get("isDirty") ? ", dirty" : ", clean"})`);
75143
+ }
75144
+ if (ctx.lastPushedGitState.get(commitsKey) !== commitsHash) {
75145
+ try {
75146
+ await ctx.deps.backend.mutation(api.workspaces.upsertRecentCommits, {
75147
+ sessionId: ctx.sessionId,
75148
+ machineId: ctx.machineId,
75149
+ workingDir,
75150
+ commits,
75151
+ hasMoreCommits
75152
+ });
75153
+ ctx.lastPushedGitState.set(commitsKey, commitsHash);
75154
+ } catch (err) {
75155
+ console.warn(`[${formatTimestamp()}] ⚠️ Recent commits push failed for ${workingDir}: ${getErrorMessage(err)}`);
75156
+ }
75133
75157
  }
75134
- await ctx.deps.backend.mutation(api.workspaces.upsertWorkspaceGitState, {
75135
- sessionId: ctx.sessionId,
75136
- machineId: ctx.machineId,
75137
- workingDir,
75138
- status: "available",
75139
- ...pipeline2.toMutationArgs(values3, false),
75140
- recentCommits: commits,
75141
- hasMoreCommits
75142
- });
75143
- ctx.lastPushedGitState.set(stateKey, hash2);
75144
- console.log(`[${formatTimestamp()}] \uD83D\uDD00 Git state pushed: ${workingDir} (${branch}${values3.get("isDirty") ? ", dirty" : ", clean"})`);
75145
75158
  prefetchMissingCommitDetails(ctx, workingDir, commits).catch((err) => {
75146
75159
  console.warn(`[${formatTimestamp()}] ⚠️ Commit pre-fetch failed for ${workingDir}: ${getErrorMessage(err)}`);
75147
75160
  });
@@ -75321,14 +75334,6 @@ var init_git_heartbeat = __esm(() => {
75321
75334
  },
75322
75335
  defaultValue: { status: "not_found" }
75323
75336
  },
75324
- {
75325
- key: "commits",
75326
- includeInSlim: false,
75327
- collect: (wd) => getRecentCommits(wd, COMMITS_PER_PAGE),
75328
- toHashable: (raw) => raw.map((c) => c.sha),
75329
- toMutationPartial: () => ({}),
75330
- defaultValue: []
75331
- },
75332
75337
  {
75333
75338
  key: "commitsAhead",
75334
75339
  includeInSlim: false,
@@ -78788,5 +78793,5 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
78788
78793
  });
78789
78794
  program2.parse();
78790
78795
 
78791
- //# debugId=6F78BECED1936ADC64756E2164756E21
78796
+ //# debugId=5C16A49415B864E364756E2164756E21
78792
78797
  //# sourceMappingURL=index.js.map