@staff0rd/assist 0.557.1 → 0.557.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/commands/sessions/web/bundle.js +273 -273
- package/dist/index.js +92 -63
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.557.
|
|
9
|
+
version: "0.557.3",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -9981,7 +9981,7 @@ import { existsSync as existsSync28, mkdirSync as mkdirSync11, readFileSync as r
|
|
|
9981
9981
|
import { homedir as homedir12 } from "os";
|
|
9982
9982
|
import { join as join26 } from "path";
|
|
9983
9983
|
function getStoreDir() {
|
|
9984
|
-
return join26(homedir12(), ".assist");
|
|
9984
|
+
return process.env.ASSIST_STORE_DIR || join26(homedir12(), ".assist");
|
|
9985
9985
|
}
|
|
9986
9986
|
function getStorePath(filename) {
|
|
9987
9987
|
return join26(getStoreDir(), filename);
|
|
@@ -34197,41 +34197,6 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
34197
34197
|
notify2();
|
|
34198
34198
|
}
|
|
34199
34199
|
|
|
34200
|
-
// src/commands/sessions/daemon/worktree/describeHeldWork.ts
|
|
34201
|
-
var MAX_ITEMS = 20;
|
|
34202
|
-
async function describeHeldWork(path77, reason4) {
|
|
34203
|
-
if (reason4.startsWith("uncommitted")) return await changedFiles(path77);
|
|
34204
|
-
if (reason4.startsWith("unpushed")) return await unpushedCommits(path77, reason4);
|
|
34205
|
-
return { summary: reason4, items: [] };
|
|
34206
|
-
}
|
|
34207
|
-
async function changedFiles(path77) {
|
|
34208
|
-
const status3 = await gitResult(path77, ["status", "--porcelain"]);
|
|
34209
|
-
const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
|
|
34210
|
-
return {
|
|
34211
|
-
summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
|
|
34212
|
-
items: capped(lines2)
|
|
34213
|
-
};
|
|
34214
|
-
}
|
|
34215
|
-
async function unpushedCommits(path77, reason4) {
|
|
34216
|
-
const log2 = await gitResult(path77, ["log", "--oneline", "@{upstream}..HEAD"]);
|
|
34217
|
-
if (!log2.ok) return { summary: reason4, items: [] };
|
|
34218
|
-
const lines2 = nonEmptyLines(log2.out);
|
|
34219
|
-
return {
|
|
34220
|
-
summary: `${lines2.length} unpushed ${lines2.length === 1 ? "commit" : "commits"}`,
|
|
34221
|
-
items: capped(lines2)
|
|
34222
|
-
};
|
|
34223
|
-
}
|
|
34224
|
-
function nonEmptyLines(out) {
|
|
34225
|
-
return out.split("\n").map((line) => line.trim()).filter((line) => line !== "");
|
|
34226
|
-
}
|
|
34227
|
-
function capped(lines2) {
|
|
34228
|
-
if (lines2.length <= MAX_ITEMS) return lines2;
|
|
34229
|
-
return [
|
|
34230
|
-
...lines2.slice(0, MAX_ITEMS),
|
|
34231
|
-
`\u2026 and ${lines2.length - MAX_ITEMS} more`
|
|
34232
|
-
];
|
|
34233
|
-
}
|
|
34234
|
-
|
|
34235
34200
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
34236
34201
|
import { existsSync as existsSync78 } from "fs";
|
|
34237
34202
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
@@ -34270,6 +34235,76 @@ async function reclaimBranch(clone, branch2) {
|
|
|
34270
34235
|
}
|
|
34271
34236
|
}
|
|
34272
34237
|
|
|
34238
|
+
// src/commands/sessions/daemon/worktree/logVanishedTree.ts
|
|
34239
|
+
function logVanishedTree(sessions, path77) {
|
|
34240
|
+
const claimants = [...sessions.values()].filter(
|
|
34241
|
+
(s) => s.cwd === path77 || s.worktree?.path === path77
|
|
34242
|
+
);
|
|
34243
|
+
if (claimants.length === 0) {
|
|
34244
|
+
daemonLog(`worktree ${path77} gone from disk and unclaimed; reclaiming it`);
|
|
34245
|
+
return;
|
|
34246
|
+
}
|
|
34247
|
+
for (const s of claimants)
|
|
34248
|
+
daemonLog(
|
|
34249
|
+
`session ${s.id} ("${s.name}") claims worktree ${path77}, which is gone from disk; reclaiming it`
|
|
34250
|
+
);
|
|
34251
|
+
}
|
|
34252
|
+
|
|
34253
|
+
// src/commands/sessions/daemon/worktree/underTempRoot.ts
|
|
34254
|
+
import { realpathSync as realpathSync3 } from "fs";
|
|
34255
|
+
import { tmpdir as tmpdir9 } from "os";
|
|
34256
|
+
import { sep as sep2 } from "path";
|
|
34257
|
+
function tempRoots() {
|
|
34258
|
+
const raw = tmpdir9();
|
|
34259
|
+
const roots = /* @__PURE__ */ new Set([raw]);
|
|
34260
|
+
try {
|
|
34261
|
+
roots.add(realpathSync3(raw));
|
|
34262
|
+
} catch {
|
|
34263
|
+
return [...roots];
|
|
34264
|
+
}
|
|
34265
|
+
return [...roots];
|
|
34266
|
+
}
|
|
34267
|
+
function underTempRoot(path77) {
|
|
34268
|
+
return tempRoots().some(
|
|
34269
|
+
(root) => path77.startsWith(root.endsWith(sep2) ? root : root + sep2)
|
|
34270
|
+
);
|
|
34271
|
+
}
|
|
34272
|
+
|
|
34273
|
+
// src/commands/sessions/daemon/worktree/describeHeldWork.ts
|
|
34274
|
+
var MAX_ITEMS = 20;
|
|
34275
|
+
async function describeHeldWork(path77, reason4) {
|
|
34276
|
+
if (reason4.startsWith("uncommitted")) return await changedFiles(path77);
|
|
34277
|
+
if (reason4.startsWith("unpushed")) return await unpushedCommits(path77, reason4);
|
|
34278
|
+
return { summary: reason4, items: [] };
|
|
34279
|
+
}
|
|
34280
|
+
async function changedFiles(path77) {
|
|
34281
|
+
const status3 = await gitResult(path77, ["status", "--porcelain"]);
|
|
34282
|
+
const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
|
|
34283
|
+
return {
|
|
34284
|
+
summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
|
|
34285
|
+
items: capped(lines2)
|
|
34286
|
+
};
|
|
34287
|
+
}
|
|
34288
|
+
async function unpushedCommits(path77, reason4) {
|
|
34289
|
+
const log2 = await gitResult(path77, ["log", "--oneline", "@{upstream}..HEAD"]);
|
|
34290
|
+
if (!log2.ok) return { summary: reason4, items: [] };
|
|
34291
|
+
const lines2 = nonEmptyLines(log2.out);
|
|
34292
|
+
return {
|
|
34293
|
+
summary: `${lines2.length} unpushed ${lines2.length === 1 ? "commit" : "commits"}`,
|
|
34294
|
+
items: capped(lines2)
|
|
34295
|
+
};
|
|
34296
|
+
}
|
|
34297
|
+
function nonEmptyLines(out) {
|
|
34298
|
+
return out.split("\n").map((line) => line.trim()).filter((line) => line !== "");
|
|
34299
|
+
}
|
|
34300
|
+
function capped(lines2) {
|
|
34301
|
+
if (lines2.length <= MAX_ITEMS) return lines2;
|
|
34302
|
+
return [
|
|
34303
|
+
...lines2.slice(0, MAX_ITEMS),
|
|
34304
|
+
`\u2026 and ${lines2.length - MAX_ITEMS} more`
|
|
34305
|
+
];
|
|
34306
|
+
}
|
|
34307
|
+
|
|
34273
34308
|
// src/commands/sessions/daemon/worktree/resurfaceOrphanedWorktree.ts
|
|
34274
34309
|
import { basename as basename22 } from "path";
|
|
34275
34310
|
function resurfaceOrphanedWorktree(sessions, spawnWith, recovered, notify2) {
|
|
@@ -34318,19 +34353,21 @@ function recoveryNotice({ orphan, held }) {
|
|
|
34318
34353
|
].join("");
|
|
34319
34354
|
}
|
|
34320
34355
|
|
|
34321
|
-
// src/commands/sessions/daemon/worktree/
|
|
34322
|
-
function
|
|
34323
|
-
|
|
34324
|
-
|
|
34325
|
-
)
|
|
34326
|
-
|
|
34327
|
-
daemonLog(`worktree ${path77} gone from disk and unclaimed; reclaiming it`);
|
|
34356
|
+
// src/commands/sessions/daemon/worktree/recoverOrphan.ts
|
|
34357
|
+
async function recoverOrphan(sessions, spawnWith, orphan, notify2) {
|
|
34358
|
+
daemonLog(`worktree ${orphan.path} orphaned across restart; reconciling`);
|
|
34359
|
+
const durability = await checkDurability(orphan.path);
|
|
34360
|
+
if (durability.durable) {
|
|
34361
|
+
await reapWorktree(orphan.path);
|
|
34328
34362
|
return;
|
|
34329
34363
|
}
|
|
34330
|
-
|
|
34331
|
-
|
|
34332
|
-
|
|
34333
|
-
|
|
34364
|
+
const held = await describeHeldWork(orphan.path, durability.reason);
|
|
34365
|
+
resurfaceOrphanedWorktree(
|
|
34366
|
+
sessions,
|
|
34367
|
+
spawnWith,
|
|
34368
|
+
{ orphan, reason: durability.reason, held },
|
|
34369
|
+
notify2
|
|
34370
|
+
);
|
|
34334
34371
|
}
|
|
34335
34372
|
|
|
34336
34373
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
@@ -34342,6 +34379,13 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
34342
34379
|
const accounted = accountedTrees(sessions);
|
|
34343
34380
|
const vanished = /* @__PURE__ */ new Map();
|
|
34344
34381
|
for (const { path: path77, clone } of readWorktreeRegistry()) {
|
|
34382
|
+
if (underTempRoot(path77)) {
|
|
34383
|
+
forgetWorktree(path77);
|
|
34384
|
+
daemonLog(
|
|
34385
|
+
`worktree ${path77} lies outside any project root; pruned from the registry rather than recovered`
|
|
34386
|
+
);
|
|
34387
|
+
continue;
|
|
34388
|
+
}
|
|
34345
34389
|
if (!existsSync79(path77)) {
|
|
34346
34390
|
logVanishedTree(sessions, path77);
|
|
34347
34391
|
vanished.set(clone, [
|
|
@@ -34356,21 +34400,6 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
34356
34400
|
for (const [clone, paths] of vanished)
|
|
34357
34401
|
await reclaimVanishedWorktrees(clone, paths);
|
|
34358
34402
|
}
|
|
34359
|
-
async function recoverOrphan(sessions, spawnWith, orphan, notify2) {
|
|
34360
|
-
daemonLog(`worktree ${orphan.path} orphaned across restart; reconciling`);
|
|
34361
|
-
const durability = await checkDurability(orphan.path);
|
|
34362
|
-
if (durability.durable) {
|
|
34363
|
-
await reapWorktree(orphan.path);
|
|
34364
|
-
return;
|
|
34365
|
-
}
|
|
34366
|
-
const held = await describeHeldWork(orphan.path, durability.reason);
|
|
34367
|
-
resurfaceOrphanedWorktree(
|
|
34368
|
-
sessions,
|
|
34369
|
-
spawnWith,
|
|
34370
|
-
{ orphan, reason: durability.reason, held },
|
|
34371
|
-
notify2
|
|
34372
|
-
);
|
|
34373
|
-
}
|
|
34374
34403
|
|
|
34375
34404
|
// src/commands/sessions/daemon/restoreAllSessions.ts
|
|
34376
34405
|
function restoreAllSessions(spawner, sessions, notify2) {
|