@staff0rd/assist 0.546.0 → 0.547.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/commands/sessions/web/bundle.js +2 -2
- package/dist/index.js +60 -39
- 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.
|
|
9
|
+
version: "0.547.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -22281,6 +22281,12 @@ function updateCommentsCache(org, repo, prNumber, comments3) {
|
|
|
22281
22281
|
}
|
|
22282
22282
|
}
|
|
22283
22283
|
|
|
22284
|
+
// src/commands/prs/listComments/agentFooter.ts
|
|
22285
|
+
function agentFooter(unresolvedCount) {
|
|
22286
|
+
if (unresolvedCount === 0) return "No unresolved threads to process.";
|
|
22287
|
+
return "Every unresolved thread is printed in full above, with its author, path:line, id, url and body. Work from this output \u2014 do not read or parse the YAML cache; fixed, wontfix and reply locate it themselves.";
|
|
22288
|
+
}
|
|
22289
|
+
|
|
22284
22290
|
// src/commands/prs/listComments/commentStyle.ts
|
|
22285
22291
|
import chalk170 from "chalk";
|
|
22286
22292
|
var plain = (text17) => text17;
|
|
@@ -22297,7 +22303,8 @@ function commentStyle() {
|
|
|
22297
22303
|
bold: plain,
|
|
22298
22304
|
dim: plain,
|
|
22299
22305
|
state: (state) => `[${state}]`,
|
|
22300
|
-
diffHunk: false
|
|
22306
|
+
diffHunk: false,
|
|
22307
|
+
agent: true
|
|
22301
22308
|
};
|
|
22302
22309
|
}
|
|
22303
22310
|
return {
|
|
@@ -22305,7 +22312,8 @@ function commentStyle() {
|
|
|
22305
22312
|
bold: chalk170.bold,
|
|
22306
22313
|
dim: chalk170.dim,
|
|
22307
22314
|
state: colouredState,
|
|
22308
|
-
diffHunk: true
|
|
22315
|
+
diffHunk: true,
|
|
22316
|
+
agent: false
|
|
22309
22317
|
};
|
|
22310
22318
|
}
|
|
22311
22319
|
|
|
@@ -22423,6 +22431,10 @@ function printComments2(result) {
|
|
|
22423
22431
|
console.log(renderResolvedIndex(resolved, style));
|
|
22424
22432
|
}
|
|
22425
22433
|
console.log(summarise(reviews.length, unresolved, resolved));
|
|
22434
|
+
if (style.agent) {
|
|
22435
|
+
console.log(agentFooter(unresolved.length));
|
|
22436
|
+
return;
|
|
22437
|
+
}
|
|
22426
22438
|
if (cachePath) {
|
|
22427
22439
|
console.log(`Saved to ${cachePath}`);
|
|
22428
22440
|
}
|
|
@@ -30440,6 +30452,17 @@ function toSessionRunInfo({
|
|
|
30440
30452
|
};
|
|
30441
30453
|
}
|
|
30442
30454
|
|
|
30455
|
+
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
30456
|
+
import { existsSync as existsSync68 } from "fs";
|
|
30457
|
+
function joinRefusal(session) {
|
|
30458
|
+
if (session.commandType === "run") return "a server run has no agent stream";
|
|
30459
|
+
if (session.closing === true) return "the session is closing";
|
|
30460
|
+
if (!session.cwd) return "the session has no working directory";
|
|
30461
|
+
if (!existsSync68(session.cwd))
|
|
30462
|
+
return "the session's workspace no longer exists";
|
|
30463
|
+
return void 0;
|
|
30464
|
+
}
|
|
30465
|
+
|
|
30443
30466
|
// src/commands/sessions/daemon/toSessionInfo.ts
|
|
30444
30467
|
function toSessionInfo(session) {
|
|
30445
30468
|
const {
|
|
@@ -30484,7 +30507,8 @@ function toSessionInfo(session) {
|
|
|
30484
30507
|
design,
|
|
30485
30508
|
verifying,
|
|
30486
30509
|
pendingPrPreview,
|
|
30487
|
-
undurable
|
|
30510
|
+
undurable,
|
|
30511
|
+
joinable: joinRefusal(session) === void 0
|
|
30488
30512
|
};
|
|
30489
30513
|
}
|
|
30490
30514
|
|
|
@@ -30594,11 +30618,11 @@ function sessionBase(id, status3) {
|
|
|
30594
30618
|
}
|
|
30595
30619
|
|
|
30596
30620
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
30597
|
-
import { existsSync as
|
|
30621
|
+
import { existsSync as existsSync70 } from "fs";
|
|
30598
30622
|
import * as pty from "node-pty";
|
|
30599
30623
|
|
|
30600
30624
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
30601
|
-
import { chmodSync, existsSync as
|
|
30625
|
+
import { chmodSync, existsSync as existsSync69, statSync as statSync11 } from "fs";
|
|
30602
30626
|
import { createRequire as createRequire3 } from "module";
|
|
30603
30627
|
import path69 from "path";
|
|
30604
30628
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -30613,7 +30637,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
30613
30637
|
`${process.platform}-${process.arch}`,
|
|
30614
30638
|
"spawn-helper"
|
|
30615
30639
|
);
|
|
30616
|
-
if (!
|
|
30640
|
+
if (!existsSync69(helper)) return;
|
|
30617
30641
|
const mode = statSync11(helper).mode;
|
|
30618
30642
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
30619
30643
|
}
|
|
@@ -30649,7 +30673,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
30649
30673
|
});
|
|
30650
30674
|
}
|
|
30651
30675
|
function refuseMissingCwd(cwd, sessionId) {
|
|
30652
|
-
if (!cwd ||
|
|
30676
|
+
if (!cwd || existsSync70(cwd)) return;
|
|
30653
30677
|
daemonLog(
|
|
30654
30678
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
30655
30679
|
);
|
|
@@ -30818,11 +30842,11 @@ function setStatus2(session, newStatus) {
|
|
|
30818
30842
|
}
|
|
30819
30843
|
|
|
30820
30844
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
30821
|
-
import { existsSync as
|
|
30845
|
+
import { existsSync as existsSync72 } from "fs";
|
|
30822
30846
|
import { basename as basename20 } from "path";
|
|
30823
30847
|
|
|
30824
30848
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
30825
|
-
import { existsSync as
|
|
30849
|
+
import { existsSync as existsSync71 } from "fs";
|
|
30826
30850
|
import { join as join86 } from "path";
|
|
30827
30851
|
|
|
30828
30852
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
@@ -30892,7 +30916,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
30892
30916
|
);
|
|
30893
30917
|
}
|
|
30894
30918
|
function strandedReason(worktreePath, cause) {
|
|
30895
|
-
if (!
|
|
30919
|
+
if (!existsSync71(join86(worktreePath, ".git")))
|
|
30896
30920
|
return "its .git link is already gone";
|
|
30897
30921
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
30898
30922
|
return "git no longer recognises it as a working tree";
|
|
@@ -30944,7 +30968,7 @@ function reason3(error) {
|
|
|
30944
30968
|
|
|
30945
30969
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
30946
30970
|
async function reapWorktree(worktreePath, force = false) {
|
|
30947
|
-
if (!
|
|
30971
|
+
if (!existsSync72(worktreePath)) {
|
|
30948
30972
|
forgetWorktree(worktreePath);
|
|
30949
30973
|
daemonLog(
|
|
30950
30974
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -30969,7 +30993,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
30969
30993
|
}
|
|
30970
30994
|
function owningClone(worktreePath) {
|
|
30971
30995
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
30972
|
-
if (recorded &&
|
|
30996
|
+
if (recorded && existsSync72(recorded)) return recorded;
|
|
30973
30997
|
const detected = mainWorktree(worktreePath);
|
|
30974
30998
|
if (detected) return detected;
|
|
30975
30999
|
daemonLog(
|
|
@@ -31097,12 +31121,12 @@ function closeGateApplies(sessions, session) {
|
|
|
31097
31121
|
}
|
|
31098
31122
|
|
|
31099
31123
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
31100
|
-
import { existsSync as
|
|
31124
|
+
import { existsSync as existsSync73, watch } from "fs";
|
|
31101
31125
|
var DEBOUNCE_MS = 500;
|
|
31102
31126
|
var POLL_MS = 3e4;
|
|
31103
31127
|
function watchGitState(cwd, onChange) {
|
|
31104
31128
|
const common = gitCommonDir(cwd);
|
|
31105
|
-
if (!common || !
|
|
31129
|
+
if (!common || !existsSync73(common)) return void 0;
|
|
31106
31130
|
const watchers = [
|
|
31107
31131
|
watchGitDir(common, onChange),
|
|
31108
31132
|
pollGitState(cwd, onChange)
|
|
@@ -31547,10 +31571,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
31547
31571
|
}
|
|
31548
31572
|
|
|
31549
31573
|
// src/commands/sessions/daemon/exitReason.ts
|
|
31550
|
-
import { existsSync as
|
|
31574
|
+
import { existsSync as existsSync74 } from "fs";
|
|
31551
31575
|
import { resolve as resolve20 } from "path";
|
|
31552
31576
|
function exitDetail(session) {
|
|
31553
|
-
if (session.cwd && !
|
|
31577
|
+
if (session.cwd && !existsSync74(session.cwd))
|
|
31554
31578
|
return `working directory ${session.cwd} no longer exists`;
|
|
31555
31579
|
return missingRunConfigCwd(session);
|
|
31556
31580
|
}
|
|
@@ -31564,7 +31588,7 @@ function missingRunConfigCwd(session) {
|
|
|
31564
31588
|
const config = resolveRunConfig(session.runName, dir);
|
|
31565
31589
|
if (!config?.cwd) return void 0;
|
|
31566
31590
|
const configured = resolve20(runConfigBaseDirFrom(dir), config.cwd);
|
|
31567
|
-
if (
|
|
31591
|
+
if (existsSync74(configured)) return void 0;
|
|
31568
31592
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
31569
31593
|
}
|
|
31570
31594
|
|
|
@@ -31605,7 +31629,7 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
31605
31629
|
}
|
|
31606
31630
|
|
|
31607
31631
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
31608
|
-
import { existsSync as
|
|
31632
|
+
import { existsSync as existsSync75, mkdirSync as mkdirSync31, watch as watch2 } from "fs";
|
|
31609
31633
|
import { dirname as dirname37 } from "path";
|
|
31610
31634
|
|
|
31611
31635
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -31691,7 +31715,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
31691
31715
|
if (timer) clearTimeout(timer);
|
|
31692
31716
|
timer = setTimeout(read, DEBOUNCE_MS2);
|
|
31693
31717
|
});
|
|
31694
|
-
if (
|
|
31718
|
+
if (existsSync75(path73)) read();
|
|
31695
31719
|
}
|
|
31696
31720
|
function refreshActivity(session) {
|
|
31697
31721
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -33074,7 +33098,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
33074
33098
|
}
|
|
33075
33099
|
|
|
33076
33100
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
33077
|
-
import { existsSync as
|
|
33101
|
+
import { existsSync as existsSync78 } from "fs";
|
|
33078
33102
|
import { basename as basename22 } from "path";
|
|
33079
33103
|
|
|
33080
33104
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -33164,9 +33188,9 @@ function capped(lines2) {
|
|
|
33164
33188
|
}
|
|
33165
33189
|
|
|
33166
33190
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
33167
|
-
import { existsSync as
|
|
33191
|
+
import { existsSync as existsSync77 } from "fs";
|
|
33168
33192
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
33169
|
-
if (!
|
|
33193
|
+
if (!existsSync77(clone)) {
|
|
33170
33194
|
for (const { path: path73 } of paths) forgetWorktree(path73);
|
|
33171
33195
|
daemonLog(
|
|
33172
33196
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -33273,7 +33297,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
33273
33297
|
const accounted = accountedTrees(sessions);
|
|
33274
33298
|
const vanished = /* @__PURE__ */ new Map();
|
|
33275
33299
|
for (const { path: path73, clone } of readWorktreeRegistry()) {
|
|
33276
|
-
if (!
|
|
33300
|
+
if (!existsSync78(path73)) {
|
|
33277
33301
|
logVanishedTree(sessions, path73);
|
|
33278
33302
|
vanished.set(clone, [
|
|
33279
33303
|
...vanished.get(clone) ?? [],
|
|
@@ -33870,13 +33894,13 @@ async function defaultConnect() {
|
|
|
33870
33894
|
}
|
|
33871
33895
|
|
|
33872
33896
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
33873
|
-
import { existsSync as
|
|
33897
|
+
import { existsSync as existsSync79, readFileSync as readFileSync55 } from "fs";
|
|
33874
33898
|
import { posix } from "path";
|
|
33875
33899
|
function hasPersistedWindowsSessions() {
|
|
33876
33900
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
33877
33901
|
if (!sessionsFile) return false;
|
|
33878
33902
|
try {
|
|
33879
|
-
if (!
|
|
33903
|
+
if (!existsSync79(sessionsFile)) return false;
|
|
33880
33904
|
const data = JSON.parse(readFileSync55(sessionsFile, "utf8"));
|
|
33881
33905
|
return Array.isArray(data) && data.length > 0;
|
|
33882
33906
|
} catch (error) {
|
|
@@ -34418,11 +34442,8 @@ var WindowsProxy = class {
|
|
|
34418
34442
|
function joinableStream(sessions, targetId) {
|
|
34419
34443
|
const target = sessions.get(targetId);
|
|
34420
34444
|
if (!target) return { reason: "no such session" };
|
|
34421
|
-
|
|
34422
|
-
|
|
34423
|
-
if (target.closing === true) return { reason: "the session is closing" };
|
|
34424
|
-
if (!target.cwd) return { reason: "the session has no working directory" };
|
|
34425
|
-
return { session: target };
|
|
34445
|
+
const reason4 = joinRefusal(target);
|
|
34446
|
+
return reason4 ? { reason: reason4 } : { session: target };
|
|
34426
34447
|
}
|
|
34427
34448
|
|
|
34428
34449
|
// src/commands/sessions/daemon/worktree/spawnIntoStream.ts
|
|
@@ -34456,7 +34477,7 @@ function addAgentToStream(ctx, targetId, prompt, harness) {
|
|
|
34456
34477
|
}
|
|
34457
34478
|
|
|
34458
34479
|
// src/commands/sessions/daemon/worktree/spawnInTree.ts
|
|
34459
|
-
import { existsSync as
|
|
34480
|
+
import { existsSync as existsSync82 } from "fs";
|
|
34460
34481
|
|
|
34461
34482
|
// src/commands/sessions/daemon/createAssistSession.ts
|
|
34462
34483
|
function createAssistSession(id, assistArgs, cwd, meta, holdPty) {
|
|
@@ -34508,10 +34529,10 @@ function resumeSession(id, sessionId, cwd, name, holdPty) {
|
|
|
34508
34529
|
}
|
|
34509
34530
|
|
|
34510
34531
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
34511
|
-
import { existsSync as
|
|
34532
|
+
import { existsSync as existsSync81 } from "fs";
|
|
34512
34533
|
|
|
34513
34534
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
34514
|
-
import { copyFileSync as copyFileSync7, existsSync as
|
|
34535
|
+
import { copyFileSync as copyFileSync7, existsSync as existsSync80, mkdirSync as mkdirSync33 } from "fs";
|
|
34515
34536
|
import { join as join88 } from "path";
|
|
34516
34537
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
34517
34538
|
const dir = projectDirForCwd(toCwd);
|
|
@@ -34522,7 +34543,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
34522
34543
|
return;
|
|
34523
34544
|
}
|
|
34524
34545
|
const dest = join88(dir, `${claudeSessionId}.jsonl`);
|
|
34525
|
-
if (
|
|
34546
|
+
if (existsSync80(dest)) {
|
|
34526
34547
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
34527
34548
|
return;
|
|
34528
34549
|
}
|
|
@@ -34566,7 +34587,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name) {
|
|
|
34566
34587
|
}
|
|
34567
34588
|
function cloneForReapedTree(missingCwd) {
|
|
34568
34589
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
34569
|
-
if (!clone || !
|
|
34590
|
+
if (!clone || !existsSync81(clone))
|
|
34570
34591
|
throw new Error(
|
|
34571
34592
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
34572
34593
|
);
|
|
@@ -34600,7 +34621,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
|
34600
34621
|
return id;
|
|
34601
34622
|
}
|
|
34602
34623
|
function resumeInTree(ctx, sessionId, cwd, name) {
|
|
34603
|
-
if (!
|
|
34624
|
+
if (!existsSync82(cwd))
|
|
34604
34625
|
return resumeInReplacementTree(ctx, sessionId, cwd, name);
|
|
34605
34626
|
const id = ctx.spawnWith((sid) => resumeSession(sid, sessionId, cwd, name));
|
|
34606
34627
|
daemonLog(`session ${id} resuming ${sessionId} in ${cwd}`);
|
|
@@ -34933,9 +34954,9 @@ function safeParse2(line) {
|
|
|
34933
34954
|
}
|
|
34934
34955
|
|
|
34935
34956
|
// src/commands/sessions/daemon/repoDirExists.ts
|
|
34936
|
-
import { existsSync as
|
|
34957
|
+
import { existsSync as existsSync83 } from "fs";
|
|
34937
34958
|
function repoDirExists(cwd) {
|
|
34938
|
-
return
|
|
34959
|
+
return existsSync83(toGitCwd(cwd));
|
|
34939
34960
|
}
|
|
34940
34961
|
|
|
34941
34962
|
// src/commands/sessions/daemon/withRepoGroups.ts
|