@staff0rd/assist 0.483.4 → 0.483.6
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 +100 -36
- 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.483.
|
|
9
|
+
version: "0.483.6",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -18603,7 +18603,7 @@ function registerRefineLaunch(program2, resumeFlag) {
|
|
|
18603
18603
|
import { randomUUID as randomUUID6 } from "crypto";
|
|
18604
18604
|
|
|
18605
18605
|
// src/commands/review/checkoutPr.ts
|
|
18606
|
-
import { execFileSync as
|
|
18606
|
+
import { execFileSync as execFileSync7 } from "child_process";
|
|
18607
18607
|
import chalk158 from "chalk";
|
|
18608
18608
|
|
|
18609
18609
|
// src/commands/sessions/daemon/daemonLog.ts
|
|
@@ -18742,6 +18742,27 @@ function checkDurabilitySync(cwd) {
|
|
|
18742
18742
|
return step2.value;
|
|
18743
18743
|
}
|
|
18744
18744
|
|
|
18745
|
+
// src/commands/sessions/daemon/worktree/reusesClone.ts
|
|
18746
|
+
function reusesClone(clone, boundTreeRoots2, options2) {
|
|
18747
|
+
if (options2.draftLike === true && options2.includeDrafts !== true) {
|
|
18748
|
+
daemonLog(
|
|
18749
|
+
`draft-type session kept in the clone ${clone}: worktree.includeDrafts is off`
|
|
18750
|
+
);
|
|
18751
|
+
return true;
|
|
18752
|
+
}
|
|
18753
|
+
if (planAllocation(clone, boundTreeRoots2) !== "primary") return false;
|
|
18754
|
+
return !wouldDisturbWorkInProgress(clone, options2.forCheckout === true);
|
|
18755
|
+
}
|
|
18756
|
+
function wouldDisturbWorkInProgress(clone, forCheckout) {
|
|
18757
|
+
if (!forCheckout) return false;
|
|
18758
|
+
const durability = checkDurabilitySync(clone);
|
|
18759
|
+
if (durability.durable) return false;
|
|
18760
|
+
daemonLog(
|
|
18761
|
+
`tree ${clone} not used for a PR checkout: ${durability.reason} \u2014 spilling to a worktree`
|
|
18762
|
+
);
|
|
18763
|
+
return true;
|
|
18764
|
+
}
|
|
18765
|
+
|
|
18745
18766
|
// src/commands/sessions/daemon/worktree/worktreeConfigFor.ts
|
|
18746
18767
|
var DISABLED = {
|
|
18747
18768
|
enabled: false,
|
|
@@ -18763,18 +18784,14 @@ function worktreeConfigFor(cwd) {
|
|
|
18763
18784
|
function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
|
|
18764
18785
|
if (!requestedCwd)
|
|
18765
18786
|
return { cwd: requestedCwd, kind: "primary", created: false };
|
|
18787
|
+
if (options2.inPlace === true) return keptInPlace(requestedCwd);
|
|
18766
18788
|
const repoRoot = findRepoRoot(requestedCwd) ?? requestedCwd;
|
|
18767
18789
|
const cfg = worktreeConfigFor(repoRoot);
|
|
18768
18790
|
if (!cfg.enabled)
|
|
18769
18791
|
return { cwd: requestedCwd, kind: "primary", created: false };
|
|
18770
18792
|
const clone = mainWorktree(repoRoot) ?? repoRoot;
|
|
18771
|
-
|
|
18772
|
-
|
|
18773
|
-
`draft-type session kept in the clone ${clone}: worktree.includeDrafts is off`
|
|
18774
|
-
);
|
|
18775
|
-
return { cwd: clone, kind: "primary", created: false, clone };
|
|
18776
|
-
}
|
|
18777
|
-
if (planAllocation(clone, boundTreeRoots2) === "primary" && !wouldDisturbWorkInProgress(clone, options2.forCheckout === true))
|
|
18793
|
+
const reuse = { ...options2, includeDrafts: cfg.includeDrafts };
|
|
18794
|
+
if (reusesClone(clone, boundTreeRoots2, reuse))
|
|
18778
18795
|
return { cwd: clone, kind: "primary", created: false, clone };
|
|
18779
18796
|
const path71 = createWorktree(
|
|
18780
18797
|
clone,
|
|
@@ -18783,14 +18800,11 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
|
|
|
18783
18800
|
);
|
|
18784
18801
|
return { cwd: path71, kind: "worktree", created: true, clone };
|
|
18785
18802
|
}
|
|
18786
|
-
function
|
|
18787
|
-
if (!forCheckout) return false;
|
|
18788
|
-
const durability = checkDurabilitySync(clone);
|
|
18789
|
-
if (durability.durable) return false;
|
|
18803
|
+
function keptInPlace(cwd) {
|
|
18790
18804
|
daemonLog(
|
|
18791
|
-
`
|
|
18805
|
+
`session kept in ${cwd}: launched against work already checked out there`
|
|
18792
18806
|
);
|
|
18793
|
-
return
|
|
18807
|
+
return { cwd, kind: "primary", created: false };
|
|
18794
18808
|
}
|
|
18795
18809
|
|
|
18796
18810
|
// src/commands/sessions/daemon/persistedSessionSchema.ts
|
|
@@ -19039,11 +19053,59 @@ async function moveToPrCheckoutTree() {
|
|
|
19039
19053
|
if (alloc.created && alloc.clone) await seed(alloc.cwd, alloc.clone);
|
|
19040
19054
|
}
|
|
19041
19055
|
|
|
19056
|
+
// src/commands/review/prHeadBranch.ts
|
|
19057
|
+
import { execFileSync as execFileSync6 } from "child_process";
|
|
19058
|
+
function prHeadBranch(number) {
|
|
19059
|
+
try {
|
|
19060
|
+
const out = execFileSync6(
|
|
19061
|
+
"gh",
|
|
19062
|
+
["pr", "view", number, "--json", "headRefName", "-q", ".headRefName"],
|
|
19063
|
+
{ encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }
|
|
19064
|
+
).trim();
|
|
19065
|
+
return out || null;
|
|
19066
|
+
} catch {
|
|
19067
|
+
return null;
|
|
19068
|
+
}
|
|
19069
|
+
}
|
|
19070
|
+
|
|
19071
|
+
// src/commands/review/worktreeHoldingBranch.ts
|
|
19072
|
+
function worktreeHoldingBranch(cwd, branch2) {
|
|
19073
|
+
const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
19074
|
+
if (!listing) return null;
|
|
19075
|
+
const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
|
|
19076
|
+
let path71 = null;
|
|
19077
|
+
for (const line of listing.split("\n")) {
|
|
19078
|
+
const trimmed = line.trim();
|
|
19079
|
+
if (trimmed.startsWith("worktree "))
|
|
19080
|
+
path71 = trimmed.slice("worktree ".length).trim();
|
|
19081
|
+
else if (trimmed === `branch refs/heads/${branch2}`)
|
|
19082
|
+
return path71 && path71 !== here ? path71 : null;
|
|
19083
|
+
}
|
|
19084
|
+
return null;
|
|
19085
|
+
}
|
|
19086
|
+
|
|
19042
19087
|
// src/commands/review/checkoutPr.ts
|
|
19088
|
+
function currentBranch2() {
|
|
19089
|
+
return gitSyncOrNull(process.cwd(), ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
19090
|
+
}
|
|
19091
|
+
function moveToExistingCheckout(number, headRef) {
|
|
19092
|
+
if (currentBranch2() === headRef) {
|
|
19093
|
+
console.log(`Already on ${headRef} for PR #${number}; reviewing here.`);
|
|
19094
|
+
return true;
|
|
19095
|
+
}
|
|
19096
|
+
const holder = worktreeHoldingBranch(process.cwd(), headRef);
|
|
19097
|
+
if (!holder) return false;
|
|
19098
|
+
process.chdir(holder);
|
|
19099
|
+
console.log(`PR #${number} is checked out in ${holder}; reviewing there.`);
|
|
19100
|
+
appendDaemonLog(`pr #${number} review moved to its checkout ${holder}`);
|
|
19101
|
+
return true;
|
|
19102
|
+
}
|
|
19043
19103
|
async function checkoutPr(number) {
|
|
19104
|
+
const headRef = prHeadBranch(number);
|
|
19105
|
+
if (headRef && moveToExistingCheckout(number, headRef)) return;
|
|
19044
19106
|
await moveToPrCheckoutTree();
|
|
19045
19107
|
try {
|
|
19046
|
-
|
|
19108
|
+
execFileSync7("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
19047
19109
|
} catch {
|
|
19048
19110
|
console.error(chalk158.red(`gh pr checkout ${number} failed; aborting.`));
|
|
19049
19111
|
process.exit(1);
|
|
@@ -20170,7 +20232,7 @@ function comment2(path71, line, body, startLine) {
|
|
|
20170
20232
|
}
|
|
20171
20233
|
|
|
20172
20234
|
// src/commands/prs/edit.ts
|
|
20173
|
-
import { execFileSync as
|
|
20235
|
+
import { execFileSync as execFileSync8 } from "child_process";
|
|
20174
20236
|
|
|
20175
20237
|
// src/commands/prs/buildPrBody.ts
|
|
20176
20238
|
function jiraBrowseUrl(key) {
|
|
@@ -20361,7 +20423,7 @@ function edit(options2) {
|
|
|
20361
20423
|
if (options2.title) args.push("--title", options2.title);
|
|
20362
20424
|
args.push("--body", newBody);
|
|
20363
20425
|
try {
|
|
20364
|
-
|
|
20426
|
+
execFileSync8("gh", args, { stdio: "inherit" });
|
|
20365
20427
|
} catch {
|
|
20366
20428
|
process.exit(1);
|
|
20367
20429
|
}
|
|
@@ -20816,7 +20878,7 @@ function buildValidatedBody(options2, usage) {
|
|
|
20816
20878
|
}
|
|
20817
20879
|
|
|
20818
20880
|
// src/commands/prs/placePr.ts
|
|
20819
|
-
import { execFileSync as
|
|
20881
|
+
import { execFileSync as execFileSync9 } from "child_process";
|
|
20820
20882
|
|
|
20821
20883
|
// src/commands/prs/buildCreateArgs.ts
|
|
20822
20884
|
function buildEditArgs(number, title, body) {
|
|
@@ -20883,7 +20945,7 @@ async function recordPrActivity() {
|
|
|
20883
20945
|
// src/commands/prs/placePr.ts
|
|
20884
20946
|
function hasUpstream2() {
|
|
20885
20947
|
try {
|
|
20886
|
-
|
|
20948
|
+
execFileSync9(
|
|
20887
20949
|
"git",
|
|
20888
20950
|
["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
|
|
20889
20951
|
{ stdio: "pipe" }
|
|
@@ -20895,13 +20957,13 @@ function hasUpstream2() {
|
|
|
20895
20957
|
}
|
|
20896
20958
|
function ensureBranchPushed() {
|
|
20897
20959
|
const args = hasUpstream2() ? ["push"] : ["push", "--set-upstream", "origin", "HEAD"];
|
|
20898
|
-
|
|
20960
|
+
execFileSync9("git", args, { stdio: "inherit" });
|
|
20899
20961
|
}
|
|
20900
20962
|
async function placePr(prNumber, title, body, options2) {
|
|
20901
20963
|
const args = prNumber !== null ? buildEditArgs(prNumber, title, body) : buildCreateArgs(title, body, options2);
|
|
20902
20964
|
try {
|
|
20903
20965
|
if (prNumber === null && !options2.head) ensureBranchPushed();
|
|
20904
|
-
|
|
20966
|
+
execFileSync9("gh", args, { stdio: "inherit" });
|
|
20905
20967
|
} catch {
|
|
20906
20968
|
process.exit(1);
|
|
20907
20969
|
}
|
|
@@ -26530,9 +26592,9 @@ function gitFailureReason(error) {
|
|
|
26530
26592
|
}
|
|
26531
26593
|
|
|
26532
26594
|
// src/commands/watch/resolveUpstream.ts
|
|
26533
|
-
import { execFileSync as
|
|
26595
|
+
import { execFileSync as execFileSync10 } from "child_process";
|
|
26534
26596
|
function runGit2(args, cwd) {
|
|
26535
|
-
return
|
|
26597
|
+
return execFileSync10("git", args, {
|
|
26536
26598
|
encoding: "utf8",
|
|
26537
26599
|
stdio: ["pipe", "pipe", "pipe"],
|
|
26538
26600
|
cwd
|
|
@@ -26580,10 +26642,10 @@ function pullFastForward(cwd) {
|
|
|
26580
26642
|
}
|
|
26581
26643
|
|
|
26582
26644
|
// src/commands/watch/fetchQuietly.ts
|
|
26583
|
-
import { execFileSync as
|
|
26645
|
+
import { execFileSync as execFileSync11 } from "child_process";
|
|
26584
26646
|
function fetchQuietly(cwd, timeoutMs) {
|
|
26585
26647
|
try {
|
|
26586
|
-
|
|
26648
|
+
execFileSync11("git", ["fetch", "--quiet"], {
|
|
26587
26649
|
stdio: ["pipe", "pipe", "pipe"],
|
|
26588
26650
|
cwd,
|
|
26589
26651
|
timeout: timeoutMs
|
|
@@ -26863,7 +26925,7 @@ async function auth() {
|
|
|
26863
26925
|
}
|
|
26864
26926
|
|
|
26865
26927
|
// src/commands/roam/postRoamActivity.ts
|
|
26866
|
-
import { execFileSync as
|
|
26928
|
+
import { execFileSync as execFileSync12 } from "child_process";
|
|
26867
26929
|
import { readdirSync as readdirSync11, readFileSync as readFileSync47, statSync as statSync9 } from "fs";
|
|
26868
26930
|
import { join as join66 } from "path";
|
|
26869
26931
|
function findPortFile(roamDir) {
|
|
@@ -26896,7 +26958,7 @@ function postRoamActivity(app, event) {
|
|
|
26896
26958
|
}
|
|
26897
26959
|
const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${app === "codex" ? 99998 : 99999}`;
|
|
26898
26960
|
try {
|
|
26899
|
-
|
|
26961
|
+
execFileSync12("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
|
|
26900
26962
|
stdio: "ignore"
|
|
26901
26963
|
});
|
|
26902
26964
|
} catch {
|
|
@@ -27117,13 +27179,13 @@ function runPreCommands(pre, cwd) {
|
|
|
27117
27179
|
}
|
|
27118
27180
|
|
|
27119
27181
|
// src/commands/run/spawnRunCommand.ts
|
|
27120
|
-
import { execFileSync as
|
|
27182
|
+
import { execFileSync as execFileSync13, spawn as spawn9 } from "child_process";
|
|
27121
27183
|
import { existsSync as existsSync58 } from "fs";
|
|
27122
27184
|
import { dirname as dirname29, join as join67, resolve as resolve15 } from "path";
|
|
27123
27185
|
function resolveCommand2(command) {
|
|
27124
27186
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
27125
27187
|
try {
|
|
27126
|
-
const gitPath =
|
|
27188
|
+
const gitPath = execFileSync13("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
27127
27189
|
const gitRoot = resolve15(dirname29(gitPath), "..");
|
|
27128
27190
|
const gitBash = join67(gitRoot, "bin", "bash.exe");
|
|
27129
27191
|
if (existsSync58(gitBash)) return gitBash;
|
|
@@ -27576,11 +27638,11 @@ function screenshot(processName) {
|
|
|
27576
27638
|
}
|
|
27577
27639
|
|
|
27578
27640
|
// src/commands/sessions/daemon/listDaemonPids.ts
|
|
27579
|
-
import { execFileSync as
|
|
27641
|
+
import { execFileSync as execFileSync14 } from "child_process";
|
|
27580
27642
|
function listDaemonPids() {
|
|
27581
27643
|
if (process.platform === "win32") return [];
|
|
27582
27644
|
try {
|
|
27583
|
-
const out =
|
|
27645
|
+
const out = execFileSync14("ps", ["-eo", "pid=,args="], {
|
|
27584
27646
|
encoding: "utf8"
|
|
27585
27647
|
});
|
|
27586
27648
|
return out.split("\n").filter((line) => line.includes("assist") && / daemon run\b/.test(line)).map((line) => Number.parseInt(line.trim(), 10)).filter((pid) => Number.isInteger(pid));
|
|
@@ -31255,7 +31317,8 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta) {
|
|
|
31255
31317
|
(sid, resolvedCwd, holdUntilSeeded) => createAssistSession(sid, assistArgs, resolvedCwd, meta, holdUntilSeeded),
|
|
31256
31318
|
{
|
|
31257
31319
|
forCheckout: isPrCheckoutArgs(assistArgs),
|
|
31258
|
-
draftLike: isDraftCommand(assistArgs[0])
|
|
31320
|
+
draftLike: isDraftCommand(assistArgs[0]),
|
|
31321
|
+
inPlace: meta?.inPlace
|
|
31259
31322
|
}
|
|
31260
31323
|
);
|
|
31261
31324
|
}
|
|
@@ -31716,7 +31779,8 @@ var messageHandlers = {
|
|
|
31716
31779
|
d.cwd,
|
|
31717
31780
|
{
|
|
31718
31781
|
title: d.title,
|
|
31719
|
-
subtitle: d.subtitle
|
|
31782
|
+
subtitle: d.subtitle,
|
|
31783
|
+
inPlace: d.inPlace === true
|
|
31720
31784
|
}
|
|
31721
31785
|
)
|
|
31722
31786
|
),
|
|
@@ -32064,7 +32128,7 @@ function summaryPathFor(jsonlPath2) {
|
|
|
32064
32128
|
}
|
|
32065
32129
|
|
|
32066
32130
|
// src/commands/sessions/summarise/summariseSession.ts
|
|
32067
|
-
import { execFileSync as
|
|
32131
|
+
import { execFileSync as execFileSync15 } from "child_process";
|
|
32068
32132
|
function summariseSession(jsonlPath2) {
|
|
32069
32133
|
const firstMessage = extractFirstUserMessage(jsonlPath2);
|
|
32070
32134
|
const backlogIds = scanSessionBacklogRefs(jsonlPath2);
|
|
@@ -32073,7 +32137,7 @@ function summariseSession(jsonlPath2) {
|
|
|
32073
32137
|
}
|
|
32074
32138
|
const prompt = buildPrompt4(firstMessage, backlogIds);
|
|
32075
32139
|
try {
|
|
32076
|
-
const output =
|
|
32140
|
+
const output = execFileSync15("claude", ["-p", "--model", "haiku", prompt], {
|
|
32077
32141
|
encoding: "utf8",
|
|
32078
32142
|
timeout: 3e4,
|
|
32079
32143
|
stdio: ["ignore", "pipe", "ignore"]
|