@staff0rd/assist 0.483.5 → 0.483.7

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.483.5",
9
+ version: "0.483.7",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -7967,9 +7967,9 @@ function groupActivityRefs(refs, commitLimit = ACTIVITY_COMMIT_LIMIT) {
7967
7967
  return {
7968
7968
  branches: newestFirst("branch"),
7969
7969
  commits: commits2.slice(0, commitLimit),
7970
+ overflowCommits: commits2.slice(commitLimit),
7970
7971
  prs: newestFirst("pr"),
7971
- slacks: newestFirst("slack"),
7972
- hiddenCommits: Math.max(0, commits2.length - commitLimit)
7972
+ slacks: newestFirst("slack")
7973
7973
  };
7974
7974
  }
7975
7975
 
@@ -7978,9 +7978,10 @@ function printRef(label2, text17, ref) {
7978
7978
  const url = ref.url ? ` ${chalk51.dim(ref.url)}` : "";
7979
7979
  console.log(` ${chalk51.cyan(label2)} ${text17}${url}`);
7980
7980
  }
7981
- function printActivity(item) {
7982
- const { branches, commits: commits2, prs: prs2, slacks, hiddenCommits } = groupActivityRefs(
7983
- item.gitRefs ?? []
7981
+ function printActivity(item, options2 = {}) {
7982
+ const { branches, commits: commits2, overflowCommits, prs: prs2, slacks } = groupActivityRefs(
7983
+ item.gitRefs ?? [],
7984
+ options2.allCommits ? Number.POSITIVE_INFINITY : void 0
7984
7985
  );
7985
7986
  if (branches.length + commits2.length + prs2.length + slacks.length === 0)
7986
7987
  return;
@@ -7992,8 +7993,10 @@ function printActivity(item) {
7992
7993
  const subject = commit2.title ? ` ${commit2.title}` : "";
7993
7994
  printRef("commit", `${commit2.ref.slice(0, 8)}${subject}`, commit2);
7994
7995
  }
7995
- if (hiddenCommits > 0) {
7996
- console.log(` ${chalk51.dim(`\u2026 and ${hiddenCommits} more commits`)}`);
7996
+ if (overflowCommits.length > 0) {
7997
+ console.log(
7998
+ ` ${chalk51.dim(`\u2026 and ${overflowCommits.length} more commits (--all-commits to show)`)}`
7999
+ );
7997
8000
  }
7998
8001
  for (const pr of prs2) {
7999
8002
  const title = pr.title ? ` ${pr.title}` : "";
@@ -8157,7 +8160,7 @@ function printComments(item) {
8157
8160
  }
8158
8161
  console.log();
8159
8162
  }
8160
- async function show(id) {
8163
+ async function show(id, options2 = {}) {
8161
8164
  const found = await findOneItem(id);
8162
8165
  if (!found) process.exit(1);
8163
8166
  const { orm, item } = found;
@@ -8171,7 +8174,7 @@ async function show(id) {
8171
8174
  printSubtasks(item);
8172
8175
  await printLinks(orm, item);
8173
8176
  printPlan(item);
8174
- printActivity(item);
8177
+ printActivity(item, { allCommits: options2.allCommits });
8175
8178
  printComments(item);
8176
8179
  }
8177
8180
 
@@ -14145,10 +14148,15 @@ function registerUpdateCommands(cmd) {
14145
14148
  ).action(movePhase);
14146
14149
  }
14147
14150
 
14148
- // src/commands/registerBacklog.ts
14151
+ // src/commands/backlog/registerShowCommands.ts
14149
14152
  function registerShowCommands(cmd) {
14150
- cmd.command("show <id>").alias("view").description("Show full detail for a backlog item").action(show);
14153
+ cmd.command("show <id>").alias("view").description("Show full detail for a backlog item").option(
14154
+ "--all-commits",
14155
+ "Show every commit in Activity instead of the newest 10"
14156
+ ).action(show);
14151
14157
  }
14158
+
14159
+ // src/commands/registerBacklog.ts
14152
14160
  function registerWebCommand(cmd) {
14153
14161
  cmd.command("web").description("Open the backlog tab in the web dashboard").option("-p, --port <number>", "Port to listen on", "3100").option("--no-open", "Do not open a browser on startup").action(web2);
14154
14162
  }
@@ -18603,7 +18611,7 @@ function registerRefineLaunch(program2, resumeFlag) {
18603
18611
  import { randomUUID as randomUUID6 } from "crypto";
18604
18612
 
18605
18613
  // src/commands/review/checkoutPr.ts
18606
- import { execFileSync as execFileSync6 } from "child_process";
18614
+ import { execFileSync as execFileSync7 } from "child_process";
18607
18615
  import chalk158 from "chalk";
18608
18616
 
18609
18617
  // src/commands/sessions/daemon/daemonLog.ts
@@ -18742,6 +18750,27 @@ function checkDurabilitySync(cwd) {
18742
18750
  return step2.value;
18743
18751
  }
18744
18752
 
18753
+ // src/commands/sessions/daemon/worktree/reusesClone.ts
18754
+ function reusesClone(clone, boundTreeRoots2, options2) {
18755
+ if (options2.draftLike === true && options2.includeDrafts !== true) {
18756
+ daemonLog(
18757
+ `draft-type session kept in the clone ${clone}: worktree.includeDrafts is off`
18758
+ );
18759
+ return true;
18760
+ }
18761
+ if (planAllocation(clone, boundTreeRoots2) !== "primary") return false;
18762
+ return !wouldDisturbWorkInProgress(clone, options2.forCheckout === true);
18763
+ }
18764
+ function wouldDisturbWorkInProgress(clone, forCheckout) {
18765
+ if (!forCheckout) return false;
18766
+ const durability = checkDurabilitySync(clone);
18767
+ if (durability.durable) return false;
18768
+ daemonLog(
18769
+ `tree ${clone} not used for a PR checkout: ${durability.reason} \u2014 spilling to a worktree`
18770
+ );
18771
+ return true;
18772
+ }
18773
+
18745
18774
  // src/commands/sessions/daemon/worktree/worktreeConfigFor.ts
18746
18775
  var DISABLED = {
18747
18776
  enabled: false,
@@ -18763,18 +18792,14 @@ function worktreeConfigFor(cwd) {
18763
18792
  function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
18764
18793
  if (!requestedCwd)
18765
18794
  return { cwd: requestedCwd, kind: "primary", created: false };
18795
+ if (options2.inPlace === true) return keptInPlace(requestedCwd);
18766
18796
  const repoRoot = findRepoRoot(requestedCwd) ?? requestedCwd;
18767
18797
  const cfg = worktreeConfigFor(repoRoot);
18768
18798
  if (!cfg.enabled)
18769
18799
  return { cwd: requestedCwd, kind: "primary", created: false };
18770
18800
  const clone = mainWorktree(repoRoot) ?? repoRoot;
18771
- if (options2.draftLike === true && cfg.includeDrafts !== true) {
18772
- daemonLog(
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))
18801
+ const reuse = { ...options2, includeDrafts: cfg.includeDrafts };
18802
+ if (reusesClone(clone, boundTreeRoots2, reuse))
18778
18803
  return { cwd: clone, kind: "primary", created: false, clone };
18779
18804
  const path71 = createWorktree(
18780
18805
  clone,
@@ -18783,14 +18808,11 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
18783
18808
  );
18784
18809
  return { cwd: path71, kind: "worktree", created: true, clone };
18785
18810
  }
18786
- function wouldDisturbWorkInProgress(clone, forCheckout) {
18787
- if (!forCheckout) return false;
18788
- const durability = checkDurabilitySync(clone);
18789
- if (durability.durable) return false;
18811
+ function keptInPlace(cwd) {
18790
18812
  daemonLog(
18791
- `tree ${clone} not used for a PR checkout: ${durability.reason} \u2014 spilling to a worktree`
18813
+ `session kept in ${cwd}: launched against work already checked out there`
18792
18814
  );
18793
- return true;
18815
+ return { cwd, kind: "primary", created: false };
18794
18816
  }
18795
18817
 
18796
18818
  // src/commands/sessions/daemon/persistedSessionSchema.ts
@@ -19039,11 +19061,59 @@ async function moveToPrCheckoutTree() {
19039
19061
  if (alloc.created && alloc.clone) await seed(alloc.cwd, alloc.clone);
19040
19062
  }
19041
19063
 
19064
+ // src/commands/review/prHeadBranch.ts
19065
+ import { execFileSync as execFileSync6 } from "child_process";
19066
+ function prHeadBranch(number) {
19067
+ try {
19068
+ const out = execFileSync6(
19069
+ "gh",
19070
+ ["pr", "view", number, "--json", "headRefName", "-q", ".headRefName"],
19071
+ { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }
19072
+ ).trim();
19073
+ return out || null;
19074
+ } catch {
19075
+ return null;
19076
+ }
19077
+ }
19078
+
19079
+ // src/commands/review/worktreeHoldingBranch.ts
19080
+ function worktreeHoldingBranch(cwd, branch2) {
19081
+ const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
19082
+ if (!listing) return null;
19083
+ const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
19084
+ let path71 = null;
19085
+ for (const line of listing.split("\n")) {
19086
+ const trimmed = line.trim();
19087
+ if (trimmed.startsWith("worktree "))
19088
+ path71 = trimmed.slice("worktree ".length).trim();
19089
+ else if (trimmed === `branch refs/heads/${branch2}`)
19090
+ return path71 && path71 !== here ? path71 : null;
19091
+ }
19092
+ return null;
19093
+ }
19094
+
19042
19095
  // src/commands/review/checkoutPr.ts
19096
+ function currentBranch2() {
19097
+ return gitSyncOrNull(process.cwd(), ["rev-parse", "--abbrev-ref", "HEAD"]);
19098
+ }
19099
+ function moveToExistingCheckout(number, headRef) {
19100
+ if (currentBranch2() === headRef) {
19101
+ console.log(`Already on ${headRef} for PR #${number}; reviewing here.`);
19102
+ return true;
19103
+ }
19104
+ const holder = worktreeHoldingBranch(process.cwd(), headRef);
19105
+ if (!holder) return false;
19106
+ process.chdir(holder);
19107
+ console.log(`PR #${number} is checked out in ${holder}; reviewing there.`);
19108
+ appendDaemonLog(`pr #${number} review moved to its checkout ${holder}`);
19109
+ return true;
19110
+ }
19043
19111
  async function checkoutPr(number) {
19112
+ const headRef = prHeadBranch(number);
19113
+ if (headRef && moveToExistingCheckout(number, headRef)) return;
19044
19114
  await moveToPrCheckoutTree();
19045
19115
  try {
19046
- execFileSync6("gh", ["pr", "checkout", number], { stdio: "inherit" });
19116
+ execFileSync7("gh", ["pr", "checkout", number], { stdio: "inherit" });
19047
19117
  } catch {
19048
19118
  console.error(chalk158.red(`gh pr checkout ${number} failed; aborting.`));
19049
19119
  process.exit(1);
@@ -20170,7 +20240,7 @@ function comment2(path71, line, body, startLine) {
20170
20240
  }
20171
20241
 
20172
20242
  // src/commands/prs/edit.ts
20173
- import { execFileSync as execFileSync7 } from "child_process";
20243
+ import { execFileSync as execFileSync8 } from "child_process";
20174
20244
 
20175
20245
  // src/commands/prs/buildPrBody.ts
20176
20246
  function jiraBrowseUrl(key) {
@@ -20361,7 +20431,7 @@ function edit(options2) {
20361
20431
  if (options2.title) args.push("--title", options2.title);
20362
20432
  args.push("--body", newBody);
20363
20433
  try {
20364
- execFileSync7("gh", args, { stdio: "inherit" });
20434
+ execFileSync8("gh", args, { stdio: "inherit" });
20365
20435
  } catch {
20366
20436
  process.exit(1);
20367
20437
  }
@@ -20816,7 +20886,7 @@ function buildValidatedBody(options2, usage) {
20816
20886
  }
20817
20887
 
20818
20888
  // src/commands/prs/placePr.ts
20819
- import { execFileSync as execFileSync8 } from "child_process";
20889
+ import { execFileSync as execFileSync9 } from "child_process";
20820
20890
 
20821
20891
  // src/commands/prs/buildCreateArgs.ts
20822
20892
  function buildEditArgs(number, title, body) {
@@ -20883,7 +20953,7 @@ async function recordPrActivity() {
20883
20953
  // src/commands/prs/placePr.ts
20884
20954
  function hasUpstream2() {
20885
20955
  try {
20886
- execFileSync8(
20956
+ execFileSync9(
20887
20957
  "git",
20888
20958
  ["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
20889
20959
  { stdio: "pipe" }
@@ -20895,13 +20965,13 @@ function hasUpstream2() {
20895
20965
  }
20896
20966
  function ensureBranchPushed() {
20897
20967
  const args = hasUpstream2() ? ["push"] : ["push", "--set-upstream", "origin", "HEAD"];
20898
- execFileSync8("git", args, { stdio: "inherit" });
20968
+ execFileSync9("git", args, { stdio: "inherit" });
20899
20969
  }
20900
20970
  async function placePr(prNumber, title, body, options2) {
20901
20971
  const args = prNumber !== null ? buildEditArgs(prNumber, title, body) : buildCreateArgs(title, body, options2);
20902
20972
  try {
20903
20973
  if (prNumber === null && !options2.head) ensureBranchPushed();
20904
- execFileSync8("gh", args, { stdio: "inherit" });
20974
+ execFileSync9("gh", args, { stdio: "inherit" });
20905
20975
  } catch {
20906
20976
  process.exit(1);
20907
20977
  }
@@ -26530,9 +26600,9 @@ function gitFailureReason(error) {
26530
26600
  }
26531
26601
 
26532
26602
  // src/commands/watch/resolveUpstream.ts
26533
- import { execFileSync as execFileSync9 } from "child_process";
26603
+ import { execFileSync as execFileSync10 } from "child_process";
26534
26604
  function runGit2(args, cwd) {
26535
- return execFileSync9("git", args, {
26605
+ return execFileSync10("git", args, {
26536
26606
  encoding: "utf8",
26537
26607
  stdio: ["pipe", "pipe", "pipe"],
26538
26608
  cwd
@@ -26580,10 +26650,10 @@ function pullFastForward(cwd) {
26580
26650
  }
26581
26651
 
26582
26652
  // src/commands/watch/fetchQuietly.ts
26583
- import { execFileSync as execFileSync10 } from "child_process";
26653
+ import { execFileSync as execFileSync11 } from "child_process";
26584
26654
  function fetchQuietly(cwd, timeoutMs) {
26585
26655
  try {
26586
- execFileSync10("git", ["fetch", "--quiet"], {
26656
+ execFileSync11("git", ["fetch", "--quiet"], {
26587
26657
  stdio: ["pipe", "pipe", "pipe"],
26588
26658
  cwd,
26589
26659
  timeout: timeoutMs
@@ -26863,7 +26933,7 @@ async function auth() {
26863
26933
  }
26864
26934
 
26865
26935
  // src/commands/roam/postRoamActivity.ts
26866
- import { execFileSync as execFileSync11 } from "child_process";
26936
+ import { execFileSync as execFileSync12 } from "child_process";
26867
26937
  import { readdirSync as readdirSync11, readFileSync as readFileSync47, statSync as statSync9 } from "fs";
26868
26938
  import { join as join66 } from "path";
26869
26939
  function findPortFile(roamDir) {
@@ -26896,7 +26966,7 @@ function postRoamActivity(app, event) {
26896
26966
  }
26897
26967
  const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${app === "codex" ? 99998 : 99999}`;
26898
26968
  try {
26899
- execFileSync11("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
26969
+ execFileSync12("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
26900
26970
  stdio: "ignore"
26901
26971
  });
26902
26972
  } catch {
@@ -27117,13 +27187,13 @@ function runPreCommands(pre, cwd) {
27117
27187
  }
27118
27188
 
27119
27189
  // src/commands/run/spawnRunCommand.ts
27120
- import { execFileSync as execFileSync12, spawn as spawn9 } from "child_process";
27190
+ import { execFileSync as execFileSync13, spawn as spawn9 } from "child_process";
27121
27191
  import { existsSync as existsSync58 } from "fs";
27122
27192
  import { dirname as dirname29, join as join67, resolve as resolve15 } from "path";
27123
27193
  function resolveCommand2(command) {
27124
27194
  if (process.platform !== "win32" || command !== "bash") return command;
27125
27195
  try {
27126
- const gitPath = execFileSync12("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
27196
+ const gitPath = execFileSync13("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
27127
27197
  const gitRoot = resolve15(dirname29(gitPath), "..");
27128
27198
  const gitBash = join67(gitRoot, "bin", "bash.exe");
27129
27199
  if (existsSync58(gitBash)) return gitBash;
@@ -27576,11 +27646,11 @@ function screenshot(processName) {
27576
27646
  }
27577
27647
 
27578
27648
  // src/commands/sessions/daemon/listDaemonPids.ts
27579
- import { execFileSync as execFileSync13 } from "child_process";
27649
+ import { execFileSync as execFileSync14 } from "child_process";
27580
27650
  function listDaemonPids() {
27581
27651
  if (process.platform === "win32") return [];
27582
27652
  try {
27583
- const out = execFileSync13("ps", ["-eo", "pid=,args="], {
27653
+ const out = execFileSync14("ps", ["-eo", "pid=,args="], {
27584
27654
  encoding: "utf8"
27585
27655
  });
27586
27656
  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 +31325,8 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta) {
31255
31325
  (sid, resolvedCwd, holdUntilSeeded) => createAssistSession(sid, assistArgs, resolvedCwd, meta, holdUntilSeeded),
31256
31326
  {
31257
31327
  forCheckout: isPrCheckoutArgs(assistArgs),
31258
- draftLike: isDraftCommand(assistArgs[0])
31328
+ draftLike: isDraftCommand(assistArgs[0]),
31329
+ inPlace: meta?.inPlace
31259
31330
  }
31260
31331
  );
31261
31332
  }
@@ -31716,7 +31787,8 @@ var messageHandlers = {
31716
31787
  d.cwd,
31717
31788
  {
31718
31789
  title: d.title,
31719
- subtitle: d.subtitle
31790
+ subtitle: d.subtitle,
31791
+ inPlace: d.inPlace === true
31720
31792
  }
31721
31793
  )
31722
31794
  ),
@@ -32064,7 +32136,7 @@ function summaryPathFor(jsonlPath2) {
32064
32136
  }
32065
32137
 
32066
32138
  // src/commands/sessions/summarise/summariseSession.ts
32067
- import { execFileSync as execFileSync14 } from "child_process";
32139
+ import { execFileSync as execFileSync15 } from "child_process";
32068
32140
  function summariseSession(jsonlPath2) {
32069
32141
  const firstMessage = extractFirstUserMessage(jsonlPath2);
32070
32142
  const backlogIds = scanSessionBacklogRefs(jsonlPath2);
@@ -32073,7 +32145,7 @@ function summariseSession(jsonlPath2) {
32073
32145
  }
32074
32146
  const prompt = buildPrompt4(firstMessage, backlogIds);
32075
32147
  try {
32076
- const output = execFileSync14("claude", ["-p", "--model", "haiku", prompt], {
32148
+ const output = execFileSync15("claude", ["-p", "--model", "haiku", prompt], {
32077
32149
  encoding: "utf8",
32078
32150
  timeout: 3e4,
32079
32151
  stdio: ["ignore", "pipe", "ignore"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.483.5",
3
+ "version": "0.483.7",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {