chatroom-cli 1.15.0 → 1.16.1
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 +28 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15501,6 +15501,30 @@ async function getOpenPRsForBranch(cwd, branch) {
|
|
|
15501
15501
|
return [];
|
|
15502
15502
|
}
|
|
15503
15503
|
}
|
|
15504
|
+
async function getRemotes(cwd) {
|
|
15505
|
+
const result = await runGit("remote -v", cwd);
|
|
15506
|
+
if ("error" in result)
|
|
15507
|
+
return [];
|
|
15508
|
+
if (!result.stdout.trim())
|
|
15509
|
+
return [];
|
|
15510
|
+
const lines = result.stdout.trim().split(`
|
|
15511
|
+
`);
|
|
15512
|
+
const seen = new Set;
|
|
15513
|
+
const remotes = [];
|
|
15514
|
+
for (const line of lines) {
|
|
15515
|
+
const match = line.match(/^(\S+)\s+(\S+)\s+\((\w+)\)$/);
|
|
15516
|
+
if (!match)
|
|
15517
|
+
continue;
|
|
15518
|
+
const [, name, url, type] = match;
|
|
15519
|
+
if (!name || !url)
|
|
15520
|
+
continue;
|
|
15521
|
+
if (type === "fetch" && !seen.has(name)) {
|
|
15522
|
+
seen.add(name);
|
|
15523
|
+
remotes.push({ name, url });
|
|
15524
|
+
}
|
|
15525
|
+
}
|
|
15526
|
+
return remotes;
|
|
15527
|
+
}
|
|
15504
15528
|
var execAsync2;
|
|
15505
15529
|
var init_git_reader = __esm(() => {
|
|
15506
15530
|
execAsync2 = promisify2(exec2);
|
|
@@ -15729,6 +15753,7 @@ async function pushSingleWorkspaceGitState(ctx, workingDir) {
|
|
|
15729
15753
|
getDiffStat(workingDir),
|
|
15730
15754
|
getRecentCommits(workingDir, COMMITS_PER_PAGE)
|
|
15731
15755
|
]);
|
|
15756
|
+
const remotes = await getRemotes(workingDir);
|
|
15732
15757
|
if (branchResult.status === "error") {
|
|
15733
15758
|
const stateHash2 = `error:${branchResult.message}`;
|
|
15734
15759
|
if (ctx.lastPushedGitState.get(stateKey) === stateHash2)
|
|
@@ -15751,7 +15776,7 @@ async function pushSingleWorkspaceGitState(ctx, workingDir) {
|
|
|
15751
15776
|
const isDirty2 = dirtyResult;
|
|
15752
15777
|
const diffStat = diffStatResult.status === "available" ? diffStatResult.diffStat : { filesChanged: 0, insertions: 0, deletions: 0 };
|
|
15753
15778
|
const hasMoreCommits = commits.length >= COMMITS_PER_PAGE;
|
|
15754
|
-
const stateHash = createHash3("md5").update(JSON.stringify({ branch, isDirty: isDirty2, diffStat, shas: commits.map((c) => c.sha), prs: openPRs.map((pr) => pr.number) })).digest("hex");
|
|
15779
|
+
const stateHash = createHash3("md5").update(JSON.stringify({ branch, isDirty: isDirty2, diffStat, shas: commits.map((c) => c.sha), prs: openPRs.map((pr) => pr.number), remotes: remotes.map((r) => `${r.name}:${r.url}`) })).digest("hex");
|
|
15755
15780
|
if (ctx.lastPushedGitState.get(stateKey) === stateHash) {
|
|
15756
15781
|
return;
|
|
15757
15782
|
}
|
|
@@ -15765,7 +15790,8 @@ async function pushSingleWorkspaceGitState(ctx, workingDir) {
|
|
|
15765
15790
|
diffStat,
|
|
15766
15791
|
recentCommits: commits,
|
|
15767
15792
|
hasMoreCommits,
|
|
15768
|
-
openPullRequests: openPRs
|
|
15793
|
+
openPullRequests: openPRs,
|
|
15794
|
+
remotes
|
|
15769
15795
|
});
|
|
15770
15796
|
ctx.lastPushedGitState.set(stateKey, stateHash);
|
|
15771
15797
|
console.log(`[${formatTimestamp()}] \uD83D\uDD00 Git state pushed: ${workingDir} (${branch}${isDirty2 ? ", dirty" : ", clean"})`);
|