@staff0rd/assist 0.795.2 → 0.796.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
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.796.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -593,7 +593,7 @@ var LEGACY_SESSIONS_KEYS = [
|
|
|
593
593
|
"windowsDaemonPort",
|
|
594
594
|
"windowsVersionCheck"
|
|
595
595
|
];
|
|
596
|
-
var LEGACY_WORKTREE_KEYS = ["watcher"];
|
|
596
|
+
var LEGACY_WORKTREE_KEYS = ["watcher", "includeDrafts"];
|
|
597
597
|
function withoutKeys(value, keys) {
|
|
598
598
|
if (!value || typeof value !== "object") return value;
|
|
599
599
|
const rest = { ...value };
|
|
@@ -965,7 +965,6 @@ var assistConfigShape = {
|
|
|
965
965
|
worktree: z5.strictObject({
|
|
966
966
|
enabled: z5.boolean().default(false),
|
|
967
967
|
trunk: z5.boolean().default(false),
|
|
968
|
-
includeDrafts: z5.boolean().default(false),
|
|
969
968
|
root: z5.string().optional(),
|
|
970
969
|
install: z5.union([z5.boolean(), z5.string(), z5.array(z5.string())]).default(true),
|
|
971
970
|
commitBeforeManualChecks: z5.boolean().default(false),
|
|
@@ -13217,18 +13216,13 @@ var sessionsConfigHelp = [
|
|
|
13217
13216
|
{
|
|
13218
13217
|
key: "worktree.enabled",
|
|
13219
13218
|
setter: "assist config set worktree.enabled true -g --repo",
|
|
13220
|
-
note: "opt in per repo: spill concurrent sessions into adjacent <clone>-N worktrees (default off)"
|
|
13219
|
+
note: "opt in per repo: spill concurrent prompt sessions into adjacent <clone>-N worktrees, and give every assist-command session (draft, bug, backlog run, review, \u2026) a fresh one (default off)"
|
|
13221
13220
|
},
|
|
13222
13221
|
{
|
|
13223
13222
|
key: "worktree.trunk",
|
|
13224
13223
|
setter: "assist config set worktree.trunk true -g --repo",
|
|
13225
13224
|
note: "trunk-based: a spilled worktree lands on the mainline, and committing jobs (backlog run <id>, review/review-pr-comments) never run in the clone \u2014 they always get a <clone>-N (default off: a worktree starts off the remote default with no mainline tracking, so the session raises its own branch and PR)"
|
|
13226
13225
|
},
|
|
13227
|
-
{
|
|
13228
|
-
key: "worktree.includeDrafts",
|
|
13229
|
-
setter: "assist config set worktree.includeDrafts true -g --repo",
|
|
13230
|
-
note: "draft/bug/refine sessions get their own <clone>-N too (default off: they run in the clone, since they change no code)"
|
|
13231
|
-
},
|
|
13232
13226
|
{
|
|
13233
13227
|
key: "worktree.root",
|
|
13234
13228
|
setter: "assist config set worktree.root ~/git -g --repo",
|
|
@@ -26288,7 +26282,7 @@ function registerRefineLaunch(program2, resumeFlag) {
|
|
|
26288
26282
|
import { randomUUID as randomUUID12 } from "crypto";
|
|
26289
26283
|
|
|
26290
26284
|
// src/commands/review/checkoutPr.ts
|
|
26291
|
-
import { execFileSync as
|
|
26285
|
+
import { execFileSync as execFileSync17 } from "child_process";
|
|
26292
26286
|
import chalk173 from "chalk";
|
|
26293
26287
|
|
|
26294
26288
|
// src/commands/sessions/daemon/daemonLog.ts
|
|
@@ -26318,6 +26312,22 @@ function recentDaemonLogLines(includeRelayed = true) {
|
|
|
26318
26312
|
import { existsSync as existsSync58 } from "fs";
|
|
26319
26313
|
import { basename as basename20, dirname as dirname30 } from "path";
|
|
26320
26314
|
|
|
26315
|
+
// src/commands/watch/fetchQuietly.ts
|
|
26316
|
+
import { execFileSync as execFileSync15 } from "child_process";
|
|
26317
|
+
var MIN_FETCH_TIMEOUT_MS = 6e4;
|
|
26318
|
+
function fetchQuietly(cwd, intervalMs) {
|
|
26319
|
+
try {
|
|
26320
|
+
execFileSync15("git", ["fetch", "--quiet"], {
|
|
26321
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
26322
|
+
cwd,
|
|
26323
|
+
timeout: Math.max(intervalMs, MIN_FETCH_TIMEOUT_MS)
|
|
26324
|
+
});
|
|
26325
|
+
return void 0;
|
|
26326
|
+
} catch (error) {
|
|
26327
|
+
return error instanceof Error ? error.message : String(error);
|
|
26328
|
+
}
|
|
26329
|
+
}
|
|
26330
|
+
|
|
26321
26331
|
// src/commands/sessions/daemon/worktree/planAllocation.ts
|
|
26322
26332
|
import { basename as basename19, join as join68 } from "path";
|
|
26323
26333
|
function planAllocation(clone, boundTreeRoots2) {
|
|
@@ -26364,6 +26374,11 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
26364
26374
|
const branches = new Set(listLocalBranches(clone));
|
|
26365
26375
|
const isTaken = (candidate) => registered.has(candidate) || existsSync58(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename20(candidate));
|
|
26366
26376
|
const path106 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
26377
|
+
const fetchError = fetchQuietly(clone, 0);
|
|
26378
|
+
if (fetchError)
|
|
26379
|
+
daemonLog(
|
|
26380
|
+
`fetch before allocating a worktree for clone ${clone} failed, branching off local refs: ${fetchError}`
|
|
26381
|
+
);
|
|
26367
26382
|
const start2 = worktreeStartPoint(clone, strategy.trunk);
|
|
26368
26383
|
gitSync(clone, [
|
|
26369
26384
|
"worktree",
|
|
@@ -26435,12 +26450,6 @@ function checkDurabilitySync(cwd) {
|
|
|
26435
26450
|
|
|
26436
26451
|
// src/commands/sessions/daemon/worktree/reusesClone.ts
|
|
26437
26452
|
function reusesClone(clone, boundTreeRoots2, options2) {
|
|
26438
|
-
if (options2.draftLike === true && options2.includeDrafts !== true) {
|
|
26439
|
-
daemonLog(
|
|
26440
|
-
`draft-type session kept in the clone ${clone}: worktree.includeDrafts is off`
|
|
26441
|
-
);
|
|
26442
|
-
return true;
|
|
26443
|
-
}
|
|
26444
26453
|
if (planAllocation(clone, boundTreeRoots2) !== "primary") {
|
|
26445
26454
|
daemonLog(
|
|
26446
26455
|
`clone ${clone} is held by a live session \u2014 spilling to a worktree`
|
|
@@ -26472,7 +26481,6 @@ function wouldDisturbWorkInProgress(clone, forCheckout) {
|
|
|
26472
26481
|
var DISABLED = {
|
|
26473
26482
|
enabled: false,
|
|
26474
26483
|
trunk: false,
|
|
26475
|
-
includeDrafts: false,
|
|
26476
26484
|
install: true,
|
|
26477
26485
|
commitBeforeManualChecks: false,
|
|
26478
26486
|
copy: [".env", "settings.local.json", ".claude/settings.local.json"]
|
|
@@ -26493,6 +26501,8 @@ function forcedSpillReason(clone, trunk, options2) {
|
|
|
26493
26501
|
return `backlog run spilled out of the clone ${clone}: backlog runs never use the clone`;
|
|
26494
26502
|
if (trunk === true && options2.commits === true)
|
|
26495
26503
|
return `committing session spilled out of the clone ${clone}: worktree.trunk is on, so a commit here would land on the local mainline`;
|
|
26504
|
+
if (options2.assistCommand !== void 0)
|
|
26505
|
+
return `assist ${options2.assistCommand} session spilled out of the clone ${clone}: only prompt sessions use the clone`;
|
|
26496
26506
|
return void 0;
|
|
26497
26507
|
}
|
|
26498
26508
|
|
|
@@ -26515,10 +26525,9 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
|
|
|
26515
26525
|
`worktree.enabled is off for ${repoRoot2}, so every session shares this tree`
|
|
26516
26526
|
);
|
|
26517
26527
|
const clone = canonicalTreePath(mainWorktree(repoRoot2) ?? repoRoot2);
|
|
26518
|
-
const reuse = { ...options2, includeDrafts: cfg.includeDrafts };
|
|
26519
26528
|
const forcedSpill = forcedSpillReason(clone, cfg.trunk, options2);
|
|
26520
26529
|
if (forcedSpill) daemonLog(forcedSpill);
|
|
26521
|
-
else if (reusesClone(clone, boundTreeRoots2,
|
|
26530
|
+
else if (reusesClone(clone, boundTreeRoots2, options2))
|
|
26522
26531
|
return { cwd: clone, kind: "primary", created: false, clone };
|
|
26523
26532
|
const path106 = createWorktree(
|
|
26524
26533
|
clone,
|
|
@@ -26895,10 +26904,10 @@ async function moveToPrCheckoutTree() {
|
|
|
26895
26904
|
}
|
|
26896
26905
|
|
|
26897
26906
|
// src/commands/review/prHeadBranch.ts
|
|
26898
|
-
import { execFileSync as
|
|
26907
|
+
import { execFileSync as execFileSync16 } from "child_process";
|
|
26899
26908
|
function prHeadBranch(number) {
|
|
26900
26909
|
try {
|
|
26901
|
-
const out =
|
|
26910
|
+
const out = execFileSync16(
|
|
26902
26911
|
"gh",
|
|
26903
26912
|
["pr", "view", number, "--json", "headRefName", "-q", ".headRefName"],
|
|
26904
26913
|
{ encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }
|
|
@@ -26960,7 +26969,7 @@ async function checkoutPr(number) {
|
|
|
26960
26969
|
if (headRef && await moveToExistingCheckout(number, headRef)) return;
|
|
26961
26970
|
await moveToPrCheckoutTree();
|
|
26962
26971
|
try {
|
|
26963
|
-
|
|
26972
|
+
execFileSync17("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
26964
26973
|
} catch {
|
|
26965
26974
|
console.error(chalk173.red(`gh pr checkout ${number} failed; aborting.`));
|
|
26966
26975
|
process.exit(1);
|
|
@@ -29684,7 +29693,7 @@ function buildValidatedBody(options2, usage) {
|
|
|
29684
29693
|
}
|
|
29685
29694
|
|
|
29686
29695
|
// src/commands/prs/placePr.ts
|
|
29687
|
-
import { execFileSync as
|
|
29696
|
+
import { execFileSync as execFileSync18 } from "child_process";
|
|
29688
29697
|
|
|
29689
29698
|
// src/commands/prs/buildCreateArgs.ts
|
|
29690
29699
|
function buildCreateArgs(title, body, options2, attachments = []) {
|
|
@@ -29770,7 +29779,7 @@ function buildEditArgs(number, title, body, attachments = []) {
|
|
|
29770
29779
|
// src/commands/prs/placePr.ts
|
|
29771
29780
|
function hasUpstream2() {
|
|
29772
29781
|
try {
|
|
29773
|
-
|
|
29782
|
+
execFileSync18(
|
|
29774
29783
|
"git",
|
|
29775
29784
|
["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
|
|
29776
29785
|
{ stdio: "pipe" }
|
|
@@ -29782,7 +29791,7 @@ function hasUpstream2() {
|
|
|
29782
29791
|
}
|
|
29783
29792
|
function ensureBranchPushed() {
|
|
29784
29793
|
const args = hasUpstream2() ? ["push"] : ["push", "--set-upstream", "origin", "HEAD"];
|
|
29785
|
-
|
|
29794
|
+
execFileSync18("git", args, { stdio: "inherit" });
|
|
29786
29795
|
}
|
|
29787
29796
|
async function placePr(prNumber, title, body, options2, attachments = []) {
|
|
29788
29797
|
const args = prNumber !== null ? buildEditArgs(prNumber, title, body, attachments) : buildCreateArgs(title, body, options2, attachments);
|
|
@@ -29928,10 +29937,10 @@ function warn(reason4) {
|
|
|
29928
29937
|
}
|
|
29929
29938
|
|
|
29930
29939
|
// src/commands/prs/enableAutoMerge.ts
|
|
29931
|
-
import { execFileSync as
|
|
29940
|
+
import { execFileSync as execFileSync19 } from "child_process";
|
|
29932
29941
|
function enableAutoMerge() {
|
|
29933
29942
|
try {
|
|
29934
|
-
|
|
29943
|
+
execFileSync19(
|
|
29935
29944
|
"gh",
|
|
29936
29945
|
["pr", "merge", getCurrentBranch2(), "--auto", "--squash"],
|
|
29937
29946
|
{ stdio: "inherit" }
|
|
@@ -34390,7 +34399,7 @@ function exitWith(message3) {
|
|
|
34390
34399
|
}
|
|
34391
34400
|
|
|
34392
34401
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
34393
|
-
import { execFileSync as
|
|
34402
|
+
import { execFileSync as execFileSync21 } from "child_process";
|
|
34394
34403
|
import chalk231 from "chalk";
|
|
34395
34404
|
|
|
34396
34405
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
@@ -34438,7 +34447,7 @@ function readGlobs(value) {
|
|
|
34438
34447
|
}
|
|
34439
34448
|
|
|
34440
34449
|
// src/commands/review/highLevel/summariseRepoTree.ts
|
|
34441
|
-
import { execFileSync as
|
|
34450
|
+
import { execFileSync as execFileSync20 } from "child_process";
|
|
34442
34451
|
import { dirname as dirname37, extname as extname4 } from "path";
|
|
34443
34452
|
var MAX_DIRECTORIES = 200;
|
|
34444
34453
|
var MAX_EXTENSIONS_PER_DIRECTORY = 6;
|
|
@@ -34454,7 +34463,7 @@ function summariseRepoTree(cwd = process.cwd()) {
|
|
|
34454
34463
|
}
|
|
34455
34464
|
function listTrackedFiles(cwd) {
|
|
34456
34465
|
try {
|
|
34457
|
-
return
|
|
34466
|
+
return execFileSync20("git", ["ls-files"], {
|
|
34458
34467
|
cwd,
|
|
34459
34468
|
encoding: "utf8",
|
|
34460
34469
|
maxBuffer: 64 * 1024 * 1024
|
|
@@ -34499,7 +34508,7 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
34499
34508
|
}
|
|
34500
34509
|
function askClaude(prompt, cwd) {
|
|
34501
34510
|
try {
|
|
34502
|
-
return
|
|
34511
|
+
return execFileSync21("claude", ["-p", "--model", "sonnet", prompt], {
|
|
34503
34512
|
cwd,
|
|
34504
34513
|
encoding: "utf8",
|
|
34505
34514
|
timeout: 12e4,
|
|
@@ -41217,20 +41226,6 @@ function consumeSimulatedDivergence(cwd) {
|
|
|
41217
41226
|
}
|
|
41218
41227
|
}
|
|
41219
41228
|
|
|
41220
|
-
// src/commands/watch/fetchQuietly.ts
|
|
41221
|
-
import { execFileSync as execFileSync21 } from "child_process";
|
|
41222
|
-
var MIN_FETCH_TIMEOUT_MS = 6e4;
|
|
41223
|
-
function fetchQuietly(cwd, intervalMs) {
|
|
41224
|
-
try {
|
|
41225
|
-
execFileSync21("git", ["fetch", "--quiet"], {
|
|
41226
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
41227
|
-
cwd,
|
|
41228
|
-
timeout: Math.max(intervalMs, MIN_FETCH_TIMEOUT_MS)
|
|
41229
|
-
});
|
|
41230
|
-
} catch {
|
|
41231
|
-
}
|
|
41232
|
-
}
|
|
41233
|
-
|
|
41234
41229
|
// src/commands/watch/detectMovement.ts
|
|
41235
41230
|
function detectMovement(from, to, count8) {
|
|
41236
41231
|
if (from === to) return void 0;
|
|
@@ -43711,9 +43706,7 @@ function isDraftCommand(command) {
|
|
|
43711
43706
|
function isCloneBoundDraft(session) {
|
|
43712
43707
|
if (session.worktree || !session.cwd) return false;
|
|
43713
43708
|
if (session.commandType !== "assist") return false;
|
|
43714
|
-
|
|
43715
|
-
const cfg = worktreeConfigFor(session.cwd);
|
|
43716
|
-
return cfg.enabled !== true || cfg.includeDrafts !== true;
|
|
43709
|
+
return isDraftCommand(session.assistArgs?.[0]);
|
|
43717
43710
|
}
|
|
43718
43711
|
|
|
43719
43712
|
// src/commands/sessions/daemon/worktree/closeGateApplies.ts
|
|
@@ -47718,7 +47711,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
|
47718
47711
|
forCheckout: isPrCheckoutArgs(assistArgs),
|
|
47719
47712
|
commits: isCommittingArgs(assistArgs),
|
|
47720
47713
|
backlogRun: isBacklogRunArgs(assistArgs),
|
|
47721
|
-
|
|
47714
|
+
assistCommand: assistArgs[0] ?? "",
|
|
47722
47715
|
inPlace: meta?.inPlace
|
|
47723
47716
|
},
|
|
47724
47717
|
context
|