chatroom-cli 1.25.0 → 1.27.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 +47 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -54351,7 +54351,8 @@ async function getOriginRepoSlug(cwd) {
|
|
|
54351
54351
|
async function getOpenPRsForBranch(cwd, branch) {
|
|
54352
54352
|
const repoSlug = await getOriginRepoSlug(cwd);
|
|
54353
54353
|
const repoFlag = repoSlug ? ` --repo ${JSON.stringify(repoSlug)}` : "";
|
|
54354
|
-
const
|
|
54354
|
+
const repoOwner = repoSlug?.split("/")[0] ?? null;
|
|
54355
|
+
const result = await runCommand(`gh pr list --head ${JSON.stringify(branch)} --state open --author @me --json number,title,url,headRefName,state,headRepositoryOwner --limit 5${repoFlag}`, cwd);
|
|
54355
54356
|
if ("error" in result) {
|
|
54356
54357
|
return [];
|
|
54357
54358
|
}
|
|
@@ -54362,7 +54363,11 @@ async function getOpenPRsForBranch(cwd, branch) {
|
|
|
54362
54363
|
const parsed = JSON.parse(output);
|
|
54363
54364
|
if (!Array.isArray(parsed))
|
|
54364
54365
|
return [];
|
|
54365
|
-
return parsed.filter((item) => typeof item === "object" && item !== null && typeof item.number === "number" && typeof item.title === "string" && typeof item.url === "string" && typeof item.headRefName === "string" && typeof item.state === "string").
|
|
54366
|
+
return parsed.filter((item) => typeof item === "object" && item !== null && typeof item.number === "number" && typeof item.title === "string" && typeof item.url === "string" && typeof item.headRefName === "string" && typeof item.state === "string").filter((item) => {
|
|
54367
|
+
if (!repoOwner || !item.headRepositoryOwner?.login)
|
|
54368
|
+
return true;
|
|
54369
|
+
return item.headRepositoryOwner.login === repoOwner;
|
|
54370
|
+
}).map((item) => ({
|
|
54366
54371
|
number: item.number,
|
|
54367
54372
|
title: item.title,
|
|
54368
54373
|
url: item.url,
|
|
@@ -54525,6 +54530,7 @@ var init_git_reader = __esm(() => {
|
|
|
54525
54530
|
|
|
54526
54531
|
// src/commands/machine/daemon-start/git-subscription.ts
|
|
54527
54532
|
import { exec as exec3 } from "child_process";
|
|
54533
|
+
import { gzipSync } from "node:zlib";
|
|
54528
54534
|
import { promisify as promisify3 } from "util";
|
|
54529
54535
|
function startGitRequestSubscription(ctx, wsClient2) {
|
|
54530
54536
|
const processedRequestIds = new Map;
|
|
@@ -54569,21 +54575,24 @@ async function processFullDiff(ctx, req) {
|
|
|
54569
54575
|
if (result.status === "available" || result.status === "truncated") {
|
|
54570
54576
|
const diffStatResult = await getDiffStat(req.workingDir);
|
|
54571
54577
|
const diffStat = diffStatResult.status === "available" ? diffStatResult.diffStat : { filesChanged: 0, insertions: 0, deletions: 0 };
|
|
54572
|
-
|
|
54578
|
+
const compressed = gzipSync(Buffer.from(result.content));
|
|
54579
|
+
const diffContentCompressed = compressed.toString("base64");
|
|
54580
|
+
await ctx.deps.backend.mutation(api.workspaces.upsertFullDiffV2, {
|
|
54573
54581
|
sessionId: ctx.sessionId,
|
|
54574
54582
|
machineId: ctx.machineId,
|
|
54575
54583
|
workingDir: req.workingDir,
|
|
54576
|
-
|
|
54584
|
+
data: { compression: "gzip", content: diffContentCompressed },
|
|
54577
54585
|
truncated: result.truncated,
|
|
54578
54586
|
diffStat
|
|
54579
54587
|
});
|
|
54580
|
-
console.log(`[${formatTimestamp()}] \uD83D\uDCC4 Full diff pushed: ${req.workingDir} (${diffStat.filesChanged} files, ${result.truncated ? "truncated" : "complete"})`);
|
|
54588
|
+
console.log(`[${formatTimestamp()}] \uD83D\uDCC4 Full diff pushed: ${req.workingDir} (${diffStat.filesChanged} files, ${(Buffer.byteLength(result.content) / 1024).toFixed(1)}KB → ${(compressed.length / 1024).toFixed(1)}KB gzip, ${result.truncated ? "truncated" : "complete"})`);
|
|
54581
54589
|
} else {
|
|
54582
|
-
|
|
54590
|
+
const emptyCompressed = gzipSync(Buffer.from("")).toString("base64");
|
|
54591
|
+
await ctx.deps.backend.mutation(api.workspaces.upsertFullDiffV2, {
|
|
54583
54592
|
sessionId: ctx.sessionId,
|
|
54584
54593
|
machineId: ctx.machineId,
|
|
54585
54594
|
workingDir: req.workingDir,
|
|
54586
|
-
|
|
54595
|
+
data: { compression: "gzip", content: emptyCompressed },
|
|
54587
54596
|
truncated: false,
|
|
54588
54597
|
diffStat: { filesChanged: 0, insertions: 0, deletions: 0 }
|
|
54589
54598
|
});
|
|
@@ -54697,7 +54706,7 @@ async function processCommitDetail(ctx, req) {
|
|
|
54697
54706
|
getCommitMetadata(req.workingDir, req.sha)
|
|
54698
54707
|
]);
|
|
54699
54708
|
if (result.status === "not_found") {
|
|
54700
|
-
await ctx.deps.backend.mutation(api.workspaces.
|
|
54709
|
+
await ctx.deps.backend.mutation(api.workspaces.upsertCommitDetailV2, {
|
|
54701
54710
|
sessionId: ctx.sessionId,
|
|
54702
54711
|
machineId: ctx.machineId,
|
|
54703
54712
|
workingDir: req.workingDir,
|
|
@@ -54710,7 +54719,7 @@ async function processCommitDetail(ctx, req) {
|
|
|
54710
54719
|
return;
|
|
54711
54720
|
}
|
|
54712
54721
|
if (result.status === "error") {
|
|
54713
|
-
await ctx.deps.backend.mutation(api.workspaces.
|
|
54722
|
+
await ctx.deps.backend.mutation(api.workspaces.upsertCommitDetailV2, {
|
|
54714
54723
|
sessionId: ctx.sessionId,
|
|
54715
54724
|
machineId: ctx.machineId,
|
|
54716
54725
|
workingDir: req.workingDir,
|
|
@@ -54724,20 +54733,22 @@ async function processCommitDetail(ctx, req) {
|
|
|
54724
54733
|
return;
|
|
54725
54734
|
}
|
|
54726
54735
|
const diffStat = extractDiffStatFromShowOutput(result.content);
|
|
54727
|
-
|
|
54736
|
+
const compressed = gzipSync(Buffer.from(result.content));
|
|
54737
|
+
const diffContentCompressed = compressed.toString("base64");
|
|
54738
|
+
await ctx.deps.backend.mutation(api.workspaces.upsertCommitDetailV2, {
|
|
54728
54739
|
sessionId: ctx.sessionId,
|
|
54729
54740
|
machineId: ctx.machineId,
|
|
54730
54741
|
workingDir: req.workingDir,
|
|
54731
54742
|
sha: req.sha,
|
|
54732
54743
|
status: "available",
|
|
54733
|
-
|
|
54744
|
+
data: { compression: "gzip", content: diffContentCompressed },
|
|
54734
54745
|
truncated: result.truncated,
|
|
54735
54746
|
message: metadata?.message,
|
|
54736
54747
|
author: metadata?.author,
|
|
54737
54748
|
date: metadata?.date,
|
|
54738
54749
|
diffStat
|
|
54739
54750
|
});
|
|
54740
|
-
console.log(`[${formatTimestamp()}] \uD83D\uDD0D Commit detail pushed: ${req.sha.slice(0, 7)} in ${req.workingDir}`);
|
|
54751
|
+
console.log(`[${formatTimestamp()}] \uD83D\uDD0D Commit detail pushed: ${req.sha.slice(0, 7)} in ${req.workingDir} (${(Buffer.byteLength(result.content) / 1024).toFixed(1)}KB → ${(compressed.length / 1024).toFixed(1)}KB gzip)`);
|
|
54741
54752
|
}
|
|
54742
54753
|
async function processMoreCommits(ctx, req) {
|
|
54743
54754
|
const offset = req.offset ?? 0;
|
|
@@ -54913,7 +54924,7 @@ async function prefetchMissingCommitDetails(ctx, workingDir, commits) {
|
|
|
54913
54924
|
if (commits.length === 0)
|
|
54914
54925
|
return;
|
|
54915
54926
|
const shas = commits.map((c) => c.sha);
|
|
54916
|
-
const missingShas = await ctx.deps.backend.query(api.workspaces.
|
|
54927
|
+
const missingShas = await ctx.deps.backend.query(api.workspaces.getMissingCommitShasV2, {
|
|
54917
54928
|
sessionId: ctx.sessionId,
|
|
54918
54929
|
machineId: ctx.machineId,
|
|
54919
54930
|
workingDir,
|
|
@@ -54934,7 +54945,7 @@ async function prefetchSingleCommit(ctx, workingDir, sha, commits) {
|
|
|
54934
54945
|
const metadata = commits.find((c) => c.sha === sha);
|
|
54935
54946
|
const result = await getCommitDetail(workingDir, sha);
|
|
54936
54947
|
if (result.status === "not_found") {
|
|
54937
|
-
await ctx.deps.backend.mutation(api.workspaces.
|
|
54948
|
+
await ctx.deps.backend.mutation(api.workspaces.upsertCommitDetailV2, {
|
|
54938
54949
|
sessionId: ctx.sessionId,
|
|
54939
54950
|
machineId: ctx.machineId,
|
|
54940
54951
|
workingDir,
|
|
@@ -54947,7 +54958,7 @@ async function prefetchSingleCommit(ctx, workingDir, sha, commits) {
|
|
|
54947
54958
|
return;
|
|
54948
54959
|
}
|
|
54949
54960
|
if (result.status === "error") {
|
|
54950
|
-
await ctx.deps.backend.mutation(api.workspaces.
|
|
54961
|
+
await ctx.deps.backend.mutation(api.workspaces.upsertCommitDetailV2, {
|
|
54951
54962
|
sessionId: ctx.sessionId,
|
|
54952
54963
|
machineId: ctx.machineId,
|
|
54953
54964
|
workingDir,
|
|
@@ -54961,13 +54972,16 @@ async function prefetchSingleCommit(ctx, workingDir, sha, commits) {
|
|
|
54961
54972
|
return;
|
|
54962
54973
|
}
|
|
54963
54974
|
const diffStat = extractDiffStatFromShowOutput(result.content);
|
|
54964
|
-
await
|
|
54975
|
+
const { gzipSync: gzipSync2 } = await import("node:zlib");
|
|
54976
|
+
const compressed = gzipSync2(Buffer.from(result.content));
|
|
54977
|
+
const diffContentCompressed = compressed.toString("base64");
|
|
54978
|
+
await ctx.deps.backend.mutation(api.workspaces.upsertCommitDetailV2, {
|
|
54965
54979
|
sessionId: ctx.sessionId,
|
|
54966
54980
|
machineId: ctx.machineId,
|
|
54967
54981
|
workingDir,
|
|
54968
54982
|
sha,
|
|
54969
54983
|
status: "available",
|
|
54970
|
-
|
|
54984
|
+
data: { compression: "gzip", content: diffContentCompressed },
|
|
54971
54985
|
truncated: result.truncated,
|
|
54972
54986
|
message: metadata?.message,
|
|
54973
54987
|
author: metadata?.author,
|
|
@@ -55286,6 +55300,7 @@ var init_command_sync_heartbeat = __esm(() => {
|
|
|
55286
55300
|
// src/commands/machine/daemon-start/file-content-fulfillment.ts
|
|
55287
55301
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
55288
55302
|
import { resolve as resolve4 } from "node:path";
|
|
55303
|
+
import { gzipSync as gzipSync2 } from "node:zlib";
|
|
55289
55304
|
function isBinaryFile(path3) {
|
|
55290
55305
|
const lastDot = path3.lastIndexOf(".");
|
|
55291
55306
|
if (lastDot === -1)
|
|
@@ -55326,12 +55341,13 @@ async function fulfillSingleRequest(ctx, request) {
|
|
|
55326
55341
|
return;
|
|
55327
55342
|
}
|
|
55328
55343
|
if (isBinaryFile(filePath)) {
|
|
55329
|
-
|
|
55344
|
+
const binaryCompressed = gzipSync2(Buffer.from("[Binary file]")).toString("base64");
|
|
55345
|
+
await ctx.deps.backend.mutation(api.workspaceFiles.fulfillFileContentV2, {
|
|
55330
55346
|
sessionId: ctx.sessionId,
|
|
55331
55347
|
machineId: ctx.machineId,
|
|
55332
55348
|
workingDir,
|
|
55333
55349
|
filePath,
|
|
55334
|
-
|
|
55350
|
+
data: { compression: "gzip", content: binaryCompressed },
|
|
55335
55351
|
encoding: "utf8",
|
|
55336
55352
|
truncated: false
|
|
55337
55353
|
});
|
|
@@ -55353,17 +55369,19 @@ async function fulfillSingleRequest(ctx, request) {
|
|
|
55353
55369
|
content = "[Error reading file]";
|
|
55354
55370
|
truncated = false;
|
|
55355
55371
|
}
|
|
55356
|
-
|
|
55372
|
+
const compressed = gzipSync2(Buffer.from(content));
|
|
55373
|
+
const contentCompressed = compressed.toString("base64");
|
|
55374
|
+
await ctx.deps.backend.mutation(api.workspaceFiles.fulfillFileContentV2, {
|
|
55357
55375
|
sessionId: ctx.sessionId,
|
|
55358
55376
|
machineId: ctx.machineId,
|
|
55359
55377
|
workingDir,
|
|
55360
55378
|
filePath,
|
|
55361
|
-
content,
|
|
55379
|
+
data: { compression: "gzip", content: contentCompressed },
|
|
55362
55380
|
encoding: "utf8",
|
|
55363
55381
|
truncated
|
|
55364
55382
|
});
|
|
55365
55383
|
const elapsed = Date.now() - startTime;
|
|
55366
|
-
console.log(`[${formatTimestamp()}] \uD83D\uDCC4 File content synced to Convex: ${filePath} (${elapsed}ms)`);
|
|
55384
|
+
console.log(`[${formatTimestamp()}] \uD83D\uDCC4 File content synced to Convex: ${filePath} (${(Buffer.byteLength(content) / 1024).toFixed(1)}KB → ${(compressed.length / 1024).toFixed(1)}KB gzip, ${elapsed}ms)`);
|
|
55367
55385
|
}
|
|
55368
55386
|
var MAX_CONTENT_BYTES, BINARY_EXTENSIONS;
|
|
55369
55387
|
var init_file_content_fulfillment = __esm(() => {
|
|
@@ -55535,6 +55553,7 @@ var init_file_tree_scanner = __esm(() => {
|
|
|
55535
55553
|
|
|
55536
55554
|
// src/commands/machine/daemon-start/file-tree-subscription.ts
|
|
55537
55555
|
import { createHash as createHash5 } from "node:crypto";
|
|
55556
|
+
import { gzipSync as gzipSync3 } from "node:zlib";
|
|
55538
55557
|
function startFileTreeSubscription(ctx, wsClient2) {
|
|
55539
55558
|
let processing = false;
|
|
55540
55559
|
const unsubscribe = wsClient2.onUpdate(api.workspaceFiles.getPendingFileTreeRequests, {
|
|
@@ -55568,12 +55587,14 @@ async function fulfillFileTreeRequests(ctx, requests) {
|
|
|
55568
55587
|
const tree = await scanFileTree(request.workingDir);
|
|
55569
55588
|
const treeJson = JSON.stringify(tree);
|
|
55570
55589
|
const treeHash = createHash5("md5").update(treeJson).digest("hex");
|
|
55571
|
-
|
|
55590
|
+
const compressed = gzipSync3(Buffer.from(treeJson));
|
|
55591
|
+
const treeJsonCompressed = compressed.toString("base64");
|
|
55592
|
+
await ctx.deps.backend.mutation(api.workspaceFiles.syncFileTreeV2, {
|
|
55572
55593
|
sessionId: ctx.sessionId,
|
|
55573
55594
|
machineId: ctx.machineId,
|
|
55574
55595
|
workingDir: request.workingDir,
|
|
55575
|
-
|
|
55576
|
-
treeHash,
|
|
55596
|
+
data: { compression: "gzip", content: treeJsonCompressed },
|
|
55597
|
+
dataHash: treeHash,
|
|
55577
55598
|
scannedAt: tree.scannedAt
|
|
55578
55599
|
});
|
|
55579
55600
|
await ctx.deps.backend.mutation(api.workspaceFiles.fulfillFileTreeRequest, {
|
|
@@ -55581,7 +55602,7 @@ async function fulfillFileTreeRequests(ctx, requests) {
|
|
|
55581
55602
|
machineId: ctx.machineId,
|
|
55582
55603
|
workingDir: request.workingDir
|
|
55583
55604
|
});
|
|
55584
|
-
console.log(`[${formatTimestamp()}] \uD83C\uDF33 File tree fulfilled: ${request.workingDir} (${tree.entries.length} entries)`);
|
|
55605
|
+
console.log(`[${formatTimestamp()}] \uD83C\uDF33 File tree fulfilled: ${request.workingDir} (${tree.entries.length} entries, ${(Buffer.byteLength(treeJson) / 1024).toFixed(1)}KB → ${(compressed.length / 1024).toFixed(1)}KB gzip)`);
|
|
55585
55606
|
} catch (err) {
|
|
55586
55607
|
console.warn(`[${formatTimestamp()}] ⚠️ File tree fulfillment failed for ${request.workingDir}: ${getErrorMessage(err)}`);
|
|
55587
55608
|
}
|