@staff0rd/assist 0.662.0 → 0.664.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.662.0",
9
+ version: "0.664.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -27498,6 +27498,32 @@ async function reply(commentId, body) {
27498
27498
  }
27499
27499
  }
27500
27500
 
27501
+ // src/commands/prs/status/fetchReviewThreads.ts
27502
+ import { execSync as execSync51 } from "child_process";
27503
+ var THREAD_QUERY2 = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { isResolved } } } } }`;
27504
+ function fetchReviewThreads(org, repo, prNumber) {
27505
+ const output = execSync51(
27506
+ `gh api graphql -f query='${THREAD_QUERY2}' -F owner=${org} -F repo=${repo} -F prNumber=${prNumber}`,
27507
+ { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }
27508
+ );
27509
+ const nodes = JSON.parse(output)?.data?.repository?.pullRequest?.reviewThreads?.nodes;
27510
+ if (!Array.isArray(nodes)) {
27511
+ throw new Error("unexpected response from gh api graphql");
27512
+ }
27513
+ return nodes;
27514
+ }
27515
+
27516
+ // src/commands/prs/status/countUnresolvedThreads.ts
27517
+ function countUnresolvedThreads(org, repo, prNumber) {
27518
+ try {
27519
+ return fetchReviewThreads(org, repo, prNumber).filter(
27520
+ (thread) => !thread.isResolved
27521
+ ).length;
27522
+ } catch {
27523
+ return null;
27524
+ }
27525
+ }
27526
+
27501
27527
  // src/commands/prs/status/describeFetchError.ts
27502
27528
  function firstLine2(text18) {
27503
27529
  const line = text18.split("\n").map((candidate) => candidate.trim()).find((candidate) => candidate.length > 0);
@@ -27522,10 +27548,10 @@ function describeFetchError(error) {
27522
27548
  }
27523
27549
 
27524
27550
  // src/commands/prs/status/fetchRepoPullRequests.ts
27525
- import { execSync as execSync51 } from "child_process";
27551
+ import { execSync as execSync52 } from "child_process";
27526
27552
  var FIELDS = "number,title,url,author,isDraft,createdAt,updatedAt,reviewDecision,latestReviews,statusCheckRollup,mergeable";
27527
27553
  function fetchRepoPullRequests(org, repo) {
27528
- const output = execSync51(
27554
+ const output = execSync52(
27529
27555
  `gh pr list --state open --json ${FIELDS} --limit 100 -R ${org}/${repo}`,
27530
27556
  { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }
27531
27557
  );
@@ -27584,7 +27610,7 @@ function toReviews(pr) {
27584
27610
  state: review2.state ?? "UNKNOWN"
27585
27611
  }));
27586
27612
  }
27587
- function toPrStatus(pr, now = Date.now()) {
27613
+ function toPrStatus(pr, unresolvedThreads, now = Date.now()) {
27588
27614
  const age = describeAge(pr.updatedAt, now);
27589
27615
  return {
27590
27616
  number: pr.number,
@@ -27600,7 +27626,8 @@ function toPrStatus(pr, now = Date.now()) {
27600
27626
  reviewDecision: pr.reviewDecision || null,
27601
27627
  reviews: toReviews(pr),
27602
27628
  checks: summariseChecks(pr.statusCheckRollup),
27603
- mergeable: pr.mergeable || "UNKNOWN"
27629
+ mergeable: pr.mergeable || "UNKNOWN",
27630
+ unresolvedThreads
27604
27631
  };
27605
27632
  }
27606
27633
 
@@ -27619,7 +27646,11 @@ function buildPrsStatusReport(repoArguments, now = Date.now()) {
27619
27646
  const repo = `${parsed.org}/${parsed.repo}`;
27620
27647
  try {
27621
27648
  const pullRequests = fetchRepoPullRequests(parsed.org, parsed.repo).map(
27622
- (pr) => toPrStatus(pr, now)
27649
+ (pr) => toPrStatus(
27650
+ pr,
27651
+ countUnresolvedThreads(parsed.org, parsed.repo, pr.number),
27652
+ now
27653
+ )
27623
27654
  );
27624
27655
  report2.repos.push({ repo, pullRequests });
27625
27656
  } catch (error) {
@@ -27659,6 +27690,13 @@ function checkLines(pr) {
27659
27690
  }
27660
27691
  return lines2;
27661
27692
  }
27693
+ function threadsLine(pr) {
27694
+ if (pr.unresolvedThreads === null) {
27695
+ return chalk186.dim("unresolved comments: unknown");
27696
+ }
27697
+ if (pr.unresolvedThreads === 0) return null;
27698
+ return chalk186.yellow(`unresolved comments: ${pr.unresolvedThreads}`);
27699
+ }
27662
27700
  function mergeableLine(pr) {
27663
27701
  if (pr.mergeable === "CONFLICTING") return chalk186.red("conflicting");
27664
27702
  if (pr.mergeable === "MERGEABLE") return null;
@@ -27671,6 +27709,7 @@ function printPrStatus(pr) {
27671
27709
  const details = [
27672
27710
  reviewLine(pr),
27673
27711
  ...checkLines(pr),
27712
+ threadsLine(pr),
27674
27713
  mergeableLine(pr),
27675
27714
  chalk186.dim(pr.url)
27676
27715
  ];
@@ -27709,7 +27748,7 @@ function prsStatus(repos2, options2) {
27709
27748
  }
27710
27749
 
27711
27750
  // src/commands/prs/wontfix.ts
27712
- import { execSync as execSync52 } from "child_process";
27751
+ import { execSync as execSync53 } from "child_process";
27713
27752
  function validateReason(reason4) {
27714
27753
  const lowerReason = reason4.toLowerCase();
27715
27754
  if (lowerReason.includes("claude") || lowerReason.includes("opus")) {
@@ -27726,7 +27765,7 @@ function validateShaReferences(reason4) {
27726
27765
  const invalidShas = [];
27727
27766
  for (const sha of shas) {
27728
27767
  try {
27729
- execSync52(`git cat-file -t ${sha}`, { stdio: "pipe" });
27768
+ execSync53(`git cat-file -t ${sha}`, { stdio: "pipe" });
27730
27769
  } catch {
27731
27770
  invalidShas.push(sha);
27732
27771
  }
@@ -28115,7 +28154,7 @@ function resolveReadTimeTarget(target) {
28115
28154
  }
28116
28155
 
28117
28156
  // src/commands/prs/fetchPrBody.ts
28118
- import { execSync as execSync53 } from "child_process";
28157
+ import { execSync as execSync54 } from "child_process";
28119
28158
  function exitGhNotInstalled() {
28120
28159
  console.error("Error: GitHub CLI (gh) is not installed.");
28121
28160
  console.error("Install it from https://cli.github.com/");
@@ -28136,7 +28175,7 @@ function currentRepo() {
28136
28175
  function fetchPrBody(number, repo) {
28137
28176
  const { org, repo: name } = repo ?? currentRepo();
28138
28177
  try {
28139
- const raw = execSync53(`gh pr view ${number} --json body -R ${org}/${name}`, {
28178
+ const raw = execSync54(`gh pr view ${number} --json body -R ${org}/${name}`, {
28140
28179
  encoding: "utf8",
28141
28180
  stdio: ["pipe", "pipe", "pipe"]
28142
28181
  });
@@ -28292,10 +28331,10 @@ import chalk190 from "chalk";
28292
28331
  import Enquirer2 from "enquirer";
28293
28332
 
28294
28333
  // src/commands/ravendb/searchItems.ts
28295
- import { execSync as execSync54 } from "child_process";
28334
+ import { execSync as execSync55 } from "child_process";
28296
28335
  import chalk189 from "chalk";
28297
28336
  function opExec(args) {
28298
- return execSync54(`op ${args}`, {
28337
+ return execSync55(`op ${args}`, {
28299
28338
  encoding: "utf8",
28300
28339
  stdio: ["pipe", "pipe", "pipe"]
28301
28340
  }).trim();
@@ -28447,7 +28486,7 @@ ${errorText}`
28447
28486
  }
28448
28487
 
28449
28488
  // src/commands/ravendb/resolveOpSecret.ts
28450
- import { execSync as execSync55 } from "child_process";
28489
+ import { execSync as execSync56 } from "child_process";
28451
28490
  import chalk194 from "chalk";
28452
28491
  function resolveOpSecret(reference) {
28453
28492
  if (!reference.startsWith("op://")) {
@@ -28455,7 +28494,7 @@ function resolveOpSecret(reference) {
28455
28494
  process.exit(1);
28456
28495
  }
28457
28496
  try {
28458
- return execSync55(`op read "${reference}"`, {
28497
+ return execSync56(`op read "${reference}"`, {
28459
28498
  encoding: "utf8",
28460
28499
  stdio: ["pipe", "pipe", "pipe"]
28461
28500
  }).trim();
@@ -28705,7 +28744,7 @@ Refactor check failed:
28705
28744
  }
28706
28745
 
28707
28746
  // src/commands/refactor/check/getViolations/index.ts
28708
- import { execSync as execSync56 } from "child_process";
28747
+ import { execSync as execSync57 } from "child_process";
28709
28748
  import fs31 from "fs";
28710
28749
  import { minimatch as minimatch6 } from "minimatch";
28711
28750
 
@@ -28755,7 +28794,7 @@ function getGitFiles(options2) {
28755
28794
  }
28756
28795
  const files = /* @__PURE__ */ new Set();
28757
28796
  if (options2.staged || options2.modified) {
28758
- const staged = execSync56("git diff --cached --name-only", {
28797
+ const staged = execSync57("git diff --cached --name-only", {
28759
28798
  encoding: "utf8"
28760
28799
  });
28761
28800
  for (const file of staged.trim().split("\n").filter(Boolean)) {
@@ -28763,7 +28802,7 @@ function getGitFiles(options2) {
28763
28802
  }
28764
28803
  }
28765
28804
  if (options2.unstaged || options2.modified) {
28766
- const unstaged = execSync56("git diff --name-only", { encoding: "utf8" });
28805
+ const unstaged = execSync57("git diff --name-only", { encoding: "utf8" });
28767
28806
  for (const file of unstaged.trim().split("\n").filter(Boolean)) {
28768
28807
  files.add(file);
28769
28808
  }
@@ -30345,9 +30384,9 @@ async function checkoutOnlySession(number) {
30345
30384
  import chalk213 from "chalk";
30346
30385
 
30347
30386
  // src/commands/review/fetchPrDiffInfo.ts
30348
- import { execSync as execSync57 } from "child_process";
30387
+ import { execSync as execSync58 } from "child_process";
30349
30388
  function getCurrentBranch3() {
30350
- return execSync57("git rev-parse --abbrev-ref HEAD", {
30389
+ return execSync58("git rev-parse --abbrev-ref HEAD", {
30351
30390
  encoding: "utf8"
30352
30391
  }).trim();
30353
30392
  }
@@ -30355,7 +30394,7 @@ function fetchPrDiffInfo() {
30355
30394
  const { org, repo } = getRepoInfo();
30356
30395
  const branch2 = getCurrentBranch3();
30357
30396
  const fields = "number,baseRefName,baseRefOid,headRefName,headRefOid";
30358
- const raw = execSync57(
30397
+ const raw = execSync58(
30359
30398
  `gh pr list --state open --head ${branch2} --json ${fields} -R ${org}/${repo}`,
30360
30399
  {
30361
30400
  encoding: "utf8",
@@ -30380,7 +30419,7 @@ function fetchPrDiffInfo() {
30380
30419
  }
30381
30420
  function fetchPrChangedFiles(prNumber) {
30382
30421
  const { org, repo } = getRepoInfo();
30383
- const out = execSync57(
30422
+ const out = execSync58(
30384
30423
  `gh api repos/${org}/${repo}/pulls/${prNumber}/files --paginate --jq ".[].filename"`,
30385
30424
  {
30386
30425
  encoding: "utf8",
@@ -30761,9 +30800,9 @@ function buildReviewPaths(repoRoot2, key) {
30761
30800
  }
30762
30801
 
30763
30802
  // src/commands/review/fetchExistingComments.ts
30764
- import { execSync as execSync58 } from "child_process";
30803
+ import { execSync as execSync59 } from "child_process";
30765
30804
  function fetchRawComments(org, repo, prNumber) {
30766
- const out = execSync58(
30805
+ const out = execSync59(
30767
30806
  `gh api --paginate repos/${org}/${repo}/pulls/${prNumber}/comments`,
30768
30807
  { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
30769
30808
  );
@@ -30794,14 +30833,14 @@ function fetchExistingComments() {
30794
30833
  }
30795
30834
 
30796
30835
  // src/commands/review/gatherContext.ts
30797
- import { execSync as execSync60 } from "child_process";
30836
+ import { execSync as execSync61 } from "child_process";
30798
30837
 
30799
30838
  // src/commands/review/fetchPrDiff.ts
30800
- import { execSync as execSync59 } from "child_process";
30839
+ import { execSync as execSync60 } from "child_process";
30801
30840
  function fetchPrDiff(prNumber, baseSha, headSha) {
30802
30841
  const { org, repo } = getRepoInfo();
30803
30842
  try {
30804
- return execSync59(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
30843
+ return execSync60(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
30805
30844
  encoding: "utf8",
30806
30845
  maxBuffer: 256 * 1024 * 1024,
30807
30846
  stdio: ["ignore", "pipe", "pipe"]
@@ -30816,10 +30855,10 @@ function isDiffTooLarge(error) {
30816
30855
  }
30817
30856
  function fetchDiffViaGit(baseSha, headSha) {
30818
30857
  try {
30819
- execSync59(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
30858
+ execSync60(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
30820
30859
  } catch {
30821
30860
  }
30822
- return execSync59(`git diff ${baseSha}...${headSha}`, {
30861
+ return execSync60(`git diff ${baseSha}...${headSha}`, {
30823
30862
  encoding: "utf8",
30824
30863
  maxBuffer: 256 * 1024 * 1024
30825
30864
  });
@@ -30827,11 +30866,11 @@ function fetchDiffViaGit(baseSha, headSha) {
30827
30866
 
30828
30867
  // src/commands/review/gatherContext.ts
30829
30868
  function gatherContext() {
30830
- const branch2 = execSync60("git rev-parse --abbrev-ref HEAD", {
30869
+ const branch2 = execSync61("git rev-parse --abbrev-ref HEAD", {
30831
30870
  encoding: "utf8"
30832
30871
  }).trim();
30833
- const sha = execSync60("git rev-parse HEAD", { encoding: "utf8" }).trim();
30834
- const shortSha = execSync60("git rev-parse --short=7 HEAD", {
30872
+ const sha = execSync61("git rev-parse HEAD", { encoding: "utf8" }).trim();
30873
+ const shortSha = execSync61("git rev-parse --short=7 HEAD", {
30835
30874
  encoding: "utf8"
30836
30875
  }).trim();
30837
30876
  const prInfo = fetchPrDiffInfo();
@@ -34798,7 +34837,7 @@ import { mkdirSync as mkdirSync31 } from "fs";
34798
34837
  import { join as join93 } from "path";
34799
34838
 
34800
34839
  // src/commands/voice/checkLockFile.ts
34801
- import { execSync as execSync61 } from "child_process";
34840
+ import { execSync as execSync62 } from "child_process";
34802
34841
  import { existsSync as existsSync78, mkdirSync as mkdirSync30, readFileSync as readFileSync58, writeFileSync as writeFileSync48 } from "fs";
34803
34842
  import { join as join92 } from "path";
34804
34843
  function isProcessAlive2(pid) {
@@ -34827,7 +34866,7 @@ function bootstrapVenv() {
34827
34866
  if (existsSync78(getVenvPython())) return;
34828
34867
  console.log("Setting up Python environment...");
34829
34868
  const pythonDir = getPythonDir();
34830
- execSync61(
34869
+ execSync62(
34831
34870
  `uv sync --project "${pythonDir}" --extra runtime --no-install-project`,
34832
34871
  {
34833
34872
  stdio: "inherit",
@@ -35448,11 +35487,11 @@ function runCommandToCompletion(command, args, env, cwd, quiet) {
35448
35487
  }
35449
35488
 
35450
35489
  // src/commands/run/runPreCommands.ts
35451
- import { execSync as execSync62 } from "child_process";
35490
+ import { execSync as execSync63 } from "child_process";
35452
35491
  function runPreCommands(pre, cwd) {
35453
35492
  for (const cmd of pre) {
35454
35493
  try {
35455
- execSync62(cmd, { stdio: "inherit", cwd });
35494
+ execSync63(cmd, { stdio: "inherit", cwd });
35456
35495
  } catch (error) {
35457
35496
  const code = error && typeof error === "object" && "status" in error ? error.status : 1;
35458
35497
  process.exit(code);
@@ -36179,7 +36218,7 @@ function registerRun(program2) {
36179
36218
  }
36180
36219
 
36181
36220
  // src/commands/screenshot/index.ts
36182
- import { execSync as execSync63 } from "child_process";
36221
+ import { execSync as execSync64 } from "child_process";
36183
36222
  import { existsSync as existsSync85, mkdirSync as mkdirSync34, unlinkSync as unlinkSync22, writeFileSync as writeFileSync51 } from "fs";
36184
36223
  import { tmpdir as tmpdir9 } from "os";
36185
36224
  import { join as join100, resolve as resolve21 } from "path";
@@ -36322,7 +36361,7 @@ function runPowerShellScript(processName, outputPath) {
36322
36361
  const scriptPath = join100(tmpdir9(), `assist-screenshot-${Date.now()}.ps1`);
36323
36362
  writeFileSync51(scriptPath, captureWindowPs1, "utf8");
36324
36363
  try {
36325
- execSync63(
36364
+ execSync64(
36326
36365
  `powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
36327
36366
  { stdio: ["ignore", "pipe", "pipe"], encoding: "utf8" }
36328
36367
  );
@@ -42614,7 +42653,7 @@ async function statusLine() {
42614
42653
  }
42615
42654
 
42616
42655
  // src/commands/update.ts
42617
- import { execSync as execSync64 } from "child_process";
42656
+ import { execSync as execSync65 } from "child_process";
42618
42657
  import * as path90 from "path";
42619
42658
 
42620
42659
  // src/commands/restartDaemonAfterUpdate.ts
@@ -42638,7 +42677,7 @@ function isGlobalNpmInstall(dir) {
42638
42677
  if (resolved.split(path90.sep).includes("node_modules")) {
42639
42678
  return true;
42640
42679
  }
42641
- const globalPrefix = execSync64("npm prefix -g", { stdio: "pipe" }).toString().trim();
42680
+ const globalPrefix = execSync65("npm prefix -g", { stdio: "pipe" }).toString().trim();
42642
42681
  return resolved.toLowerCase().startsWith(path90.resolve(globalPrefix).toLowerCase());
42643
42682
  } catch {
42644
42683
  return false;
@@ -42649,18 +42688,18 @@ async function update2() {
42649
42688
  console.log(`Assist is installed at: ${installDir}`);
42650
42689
  if (isGitRepo(installDir)) {
42651
42690
  console.log("Detected git repo installation, pulling latest...");
42652
- execSync64("git pull", { cwd: installDir, stdio: "inherit" });
42691
+ execSync65("git pull", { cwd: installDir, stdio: "inherit" });
42653
42692
  console.log("Installing dependencies...");
42654
- execSync64("npm i", { cwd: installDir, stdio: "inherit" });
42693
+ execSync65("npm i", { cwd: installDir, stdio: "inherit" });
42655
42694
  console.log("Building...");
42656
- execSync64("npm run build", { cwd: installDir, stdio: "inherit" });
42695
+ execSync65("npm run build", { cwd: installDir, stdio: "inherit" });
42657
42696
  console.log("Syncing commands...");
42658
- execSync64("assist sync", { stdio: "inherit" });
42697
+ execSync65("assist sync", { stdio: "inherit" });
42659
42698
  } else if (isGlobalNpmInstall(installDir)) {
42660
42699
  console.log("Detected global npm installation, updating...");
42661
- execSync64("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
42700
+ execSync65("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
42662
42701
  console.log("Syncing commands...");
42663
- execSync64("assist sync", { stdio: "inherit" });
42702
+ execSync65("assist sync", { stdio: "inherit" });
42664
42703
  } else {
42665
42704
  console.error(
42666
42705
  "Could not determine installation method. Expected a git repo or global npm install."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.662.0",
3
+ "version": "0.664.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {