vibora 3.2.3 → 3.2.4
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.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/jpeg" href="/logo-dark.jpg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Vibora</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-DsIEUj1Y.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-B-ZyeVRF.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -147256,7 +147256,11 @@ async function deleteWorktree(worktreePath, repoPath) {
|
|
|
147256
147256
|
}
|
|
147257
147257
|
var app7 = new Hono2;
|
|
147258
147258
|
app7.get("/", (c) => {
|
|
147259
|
+
c.header("X-Accel-Buffering", "no");
|
|
147259
147260
|
return streamSSE(c, async (stream3) => {
|
|
147261
|
+
await stream3.write(`: ping
|
|
147262
|
+
|
|
147263
|
+
`);
|
|
147260
147264
|
const worktreeBasePath = getWorktreeBasePath();
|
|
147261
147265
|
if (!fs6.existsSync(worktreeBasePath)) {
|
|
147262
147266
|
await stream3.writeSSE({
|
|
@@ -147358,6 +147362,72 @@ app7.get("/", (c) => {
|
|
|
147358
147362
|
});
|
|
147359
147363
|
});
|
|
147360
147364
|
});
|
|
147365
|
+
app7.get("/json", async (c) => {
|
|
147366
|
+
const worktreeBasePath = getWorktreeBasePath();
|
|
147367
|
+
if (!fs6.existsSync(worktreeBasePath)) {
|
|
147368
|
+
return c.json({
|
|
147369
|
+
worktrees: [],
|
|
147370
|
+
summary: {
|
|
147371
|
+
total: 0,
|
|
147372
|
+
orphaned: 0,
|
|
147373
|
+
totalSize: 0,
|
|
147374
|
+
totalSizeFormatted: "0 B"
|
|
147375
|
+
}
|
|
147376
|
+
});
|
|
147377
|
+
}
|
|
147378
|
+
const allTasks = db.select().from(tasks).all();
|
|
147379
|
+
const worktreeToTask = new Map;
|
|
147380
|
+
for (const task of allTasks) {
|
|
147381
|
+
if (task.worktreePath) {
|
|
147382
|
+
worktreeToTask.set(task.worktreePath, task);
|
|
147383
|
+
}
|
|
147384
|
+
}
|
|
147385
|
+
const entries = fs6.readdirSync(worktreeBasePath, { withFileTypes: true });
|
|
147386
|
+
const worktrees = [];
|
|
147387
|
+
for (const entry of entries) {
|
|
147388
|
+
if (!entry.isDirectory())
|
|
147389
|
+
continue;
|
|
147390
|
+
const fullPath = path8.join(worktreeBasePath, entry.name);
|
|
147391
|
+
const gitPath = path8.join(fullPath, ".git");
|
|
147392
|
+
if (!fs6.existsSync(gitPath))
|
|
147393
|
+
continue;
|
|
147394
|
+
const stats = fs6.statSync(fullPath);
|
|
147395
|
+
const linkedTask = worktreeToTask.get(fullPath);
|
|
147396
|
+
const [size, branch] = await Promise.all([
|
|
147397
|
+
getDirectorySizeAsync(fullPath),
|
|
147398
|
+
getGitBranchAsync(fullPath)
|
|
147399
|
+
]);
|
|
147400
|
+
worktrees.push({
|
|
147401
|
+
path: fullPath,
|
|
147402
|
+
name: entry.name,
|
|
147403
|
+
lastModified: stats.mtime.toISOString(),
|
|
147404
|
+
isOrphaned: !linkedTask,
|
|
147405
|
+
taskId: linkedTask?.id,
|
|
147406
|
+
taskTitle: linkedTask?.title,
|
|
147407
|
+
taskStatus: linkedTask?.status,
|
|
147408
|
+
repoPath: linkedTask?.repoPath,
|
|
147409
|
+
size,
|
|
147410
|
+
sizeFormatted: formatBytes(size),
|
|
147411
|
+
branch
|
|
147412
|
+
});
|
|
147413
|
+
}
|
|
147414
|
+
worktrees.sort((a, b) => {
|
|
147415
|
+
if (a.isOrphaned !== b.isOrphaned) {
|
|
147416
|
+
return a.isOrphaned ? -1 : 1;
|
|
147417
|
+
}
|
|
147418
|
+
return new Date(b.lastModified).getTime() - new Date(a.lastModified).getTime();
|
|
147419
|
+
});
|
|
147420
|
+
const totalSize = worktrees.reduce((sum, w) => sum + (w.size || 0), 0);
|
|
147421
|
+
return c.json({
|
|
147422
|
+
worktrees,
|
|
147423
|
+
summary: {
|
|
147424
|
+
total: worktrees.length,
|
|
147425
|
+
orphaned: worktrees.filter((w) => w.isOrphaned).length,
|
|
147426
|
+
totalSize,
|
|
147427
|
+
totalSizeFormatted: formatBytes(totalSize)
|
|
147428
|
+
}
|
|
147429
|
+
});
|
|
147430
|
+
});
|
|
147361
147431
|
app7.delete("/", async (c) => {
|
|
147362
147432
|
try {
|
|
147363
147433
|
const body = await c.req.json();
|