@staff0rd/assist 0.239.0 → 0.239.1

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.
Files changed (2) hide show
  1. package/dist/index.js +65 -40
  2. 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.239.0",
9
+ version: "0.239.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -13006,12 +13006,41 @@ function fetchExistingComments() {
13006
13006
  }
13007
13007
 
13008
13008
  // src/commands/review/gatherContext.ts
13009
- import { execSync as execSync42 } from "child_process";
13009
+ import { execSync as execSync43 } from "child_process";
13010
13010
 
13011
- // src/commands/review/fetchPrDiffInfo.ts
13011
+ // src/commands/review/fetchPrDiff.ts
13012
13012
  import { execSync as execSync41 } from "child_process";
13013
+ function fetchPrDiff(prNumber, baseSha, headSha) {
13014
+ const { org, repo } = getRepoInfo();
13015
+ try {
13016
+ return execSync41(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
13017
+ encoding: "utf-8",
13018
+ maxBuffer: 256 * 1024 * 1024,
13019
+ stdio: ["ignore", "pipe", "pipe"]
13020
+ });
13021
+ } catch (error) {
13022
+ if (!isDiffTooLarge(error)) throw error;
13023
+ return fetchDiffViaGit(baseSha, headSha);
13024
+ }
13025
+ }
13026
+ function isDiffTooLarge(error) {
13027
+ return error instanceof Error && (error.message.includes("too_large") || error.message.includes("maximum number of files"));
13028
+ }
13029
+ function fetchDiffViaGit(baseSha, headSha) {
13030
+ try {
13031
+ execSync41(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
13032
+ } catch {
13033
+ }
13034
+ return execSync41(`git diff ${baseSha}...${headSha}`, {
13035
+ encoding: "utf-8",
13036
+ maxBuffer: 256 * 1024 * 1024
13037
+ });
13038
+ }
13039
+
13040
+ // src/commands/review/fetchPrDiffInfo.ts
13041
+ import { execSync as execSync42 } from "child_process";
13013
13042
  function getCurrentBranch2() {
13014
- return execSync41("git rev-parse --abbrev-ref HEAD", {
13043
+ return execSync42("git rev-parse --abbrev-ref HEAD", {
13015
13044
  encoding: "utf-8"
13016
13045
  }).trim();
13017
13046
  }
@@ -13021,7 +13050,7 @@ function fetchPrDiffInfo() {
13021
13050
  const fields = "number,baseRefName,baseRefOid,headRefName,headRefOid";
13022
13051
  let raw;
13023
13052
  try {
13024
- raw = execSync41(`gh pr view ${branch} --json ${fields} -R ${org}/${repo}`, {
13053
+ raw = execSync42(`gh pr view ${branch} --json ${fields} -R ${org}/${repo}`, {
13025
13054
  encoding: "utf-8",
13026
13055
  stdio: ["ignore", "pipe", "pipe"]
13027
13056
  });
@@ -13045,32 +13074,28 @@ function fetchPrDiffInfo() {
13045
13074
  }
13046
13075
  function fetchPrChangedFiles(prNumber) {
13047
13076
  const { org, repo } = getRepoInfo();
13048
- const out = execSync41(`gh pr diff ${prNumber} --name-only -R ${org}/${repo}`, {
13049
- encoding: "utf-8",
13050
- maxBuffer: 64 * 1024 * 1024
13051
- });
13077
+ const out = execSync42(
13078
+ `gh api repos/${org}/${repo}/pulls/${prNumber}/files --paginate --jq ".[].filename"`,
13079
+ {
13080
+ encoding: "utf-8",
13081
+ maxBuffer: 64 * 1024 * 1024
13082
+ }
13083
+ );
13052
13084
  return out.trim().split("\n").filter(Boolean);
13053
13085
  }
13054
- function fetchPrDiff(prNumber) {
13055
- const { org, repo } = getRepoInfo();
13056
- return execSync41(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
13057
- encoding: "utf-8",
13058
- maxBuffer: 256 * 1024 * 1024
13059
- });
13060
- }
13061
13086
 
13062
13087
  // src/commands/review/gatherContext.ts
13063
13088
  function gatherContext() {
13064
- const branch = execSync42("git rev-parse --abbrev-ref HEAD", {
13089
+ const branch = execSync43("git rev-parse --abbrev-ref HEAD", {
13065
13090
  encoding: "utf-8"
13066
13091
  }).trim();
13067
- const sha = execSync42("git rev-parse HEAD", { encoding: "utf-8" }).trim();
13068
- const shortSha = execSync42("git rev-parse --short=7 HEAD", {
13092
+ const sha = execSync43("git rev-parse HEAD", { encoding: "utf-8" }).trim();
13093
+ const shortSha = execSync43("git rev-parse --short=7 HEAD", {
13069
13094
  encoding: "utf-8"
13070
13095
  }).trim();
13071
13096
  const prInfo = fetchPrDiffInfo();
13072
13097
  const changedFiles = fetchPrChangedFiles(prInfo.prNumber);
13073
- const diff2 = fetchPrDiff(prInfo.prNumber);
13098
+ const diff2 = fetchPrDiff(prInfo.prNumber, prInfo.baseSha, prInfo.headSha);
13074
13099
  return {
13075
13100
  branch,
13076
13101
  sha,
@@ -14377,11 +14402,11 @@ async function reviewPr(repoRoot, options2) {
14377
14402
  }
14378
14403
 
14379
14404
  // src/commands/review/gatherShaContext.ts
14380
- import { execSync as execSync43 } from "child_process";
14405
+ import { execSync as execSync44 } from "child_process";
14381
14406
  function resolveSha(ref, format2) {
14382
14407
  const flag = format2 === "short" ? "--short=7 " : "";
14383
14408
  try {
14384
- return execSync43(`git rev-parse --verify ${flag}${ref}^{commit}`, {
14409
+ return execSync44(`git rev-parse --verify ${flag}${ref}^{commit}`, {
14385
14410
  encoding: "utf-8",
14386
14411
  stdio: ["ignore", "pipe", "pipe"]
14387
14412
  }).trim();
@@ -14395,11 +14420,11 @@ function gatherShaContext(ref) {
14395
14420
  const shortSha = resolveSha(sha, "short");
14396
14421
  const parentSha = resolveSha(`${sha}^`, "long");
14397
14422
  const range = `${parentSha}..${sha}`;
14398
- const changedFiles = execSync43(`git diff --name-only ${range}`, {
14423
+ const changedFiles = execSync44(`git diff --name-only ${range}`, {
14399
14424
  encoding: "utf-8",
14400
14425
  maxBuffer: 64 * 1024 * 1024
14401
14426
  }).trim().split("\n").filter(Boolean);
14402
- const diff2 = execSync43(`git diff ${range}`, {
14427
+ const diff2 = execSync44(`git diff ${range}`, {
14403
14428
  encoding: "utf-8",
14404
14429
  maxBuffer: 256 * 1024 * 1024
14405
14430
  });
@@ -15834,7 +15859,7 @@ import { mkdirSync as mkdirSync14 } from "fs";
15834
15859
  import { join as join45 } from "path";
15835
15860
 
15836
15861
  // src/commands/voice/checkLockFile.ts
15837
- import { execSync as execSync44 } from "child_process";
15862
+ import { execSync as execSync45 } from "child_process";
15838
15863
  import { existsSync as existsSync44, mkdirSync as mkdirSync13, readFileSync as readFileSync34, writeFileSync as writeFileSync27 } from "fs";
15839
15864
  import { join as join44 } from "path";
15840
15865
  function isProcessAlive2(pid) {
@@ -15863,7 +15888,7 @@ function bootstrapVenv() {
15863
15888
  if (existsSync44(getVenvPython())) return;
15864
15889
  console.log("Setting up Python environment...");
15865
15890
  const pythonDir = getPythonDir();
15866
- execSync44(
15891
+ execSync45(
15867
15892
  `uv sync --project "${pythonDir}" --extra runtime --no-install-project`,
15868
15893
  {
15869
15894
  stdio: "inherit",
@@ -16030,11 +16055,11 @@ import { randomBytes } from "crypto";
16030
16055
  import chalk153 from "chalk";
16031
16056
 
16032
16057
  // src/lib/openBrowser.ts
16033
- import { execSync as execSync45 } from "child_process";
16058
+ import { execSync as execSync46 } from "child_process";
16034
16059
  function tryExec(commands) {
16035
16060
  for (const cmd of commands) {
16036
16061
  try {
16037
- execSync45(cmd);
16062
+ execSync46(cmd);
16038
16063
  return true;
16039
16064
  } catch {
16040
16065
  }
@@ -16376,11 +16401,11 @@ function resolveParams(params, cliArgs) {
16376
16401
  }
16377
16402
 
16378
16403
  // src/commands/run/runPreCommands.ts
16379
- import { execSync as execSync46 } from "child_process";
16404
+ import { execSync as execSync47 } from "child_process";
16380
16405
  function runPreCommands(pre, cwd) {
16381
16406
  for (const cmd of pre) {
16382
16407
  try {
16383
- execSync46(cmd, { stdio: "inherit", cwd });
16408
+ execSync47(cmd, { stdio: "inherit", cwd });
16384
16409
  } catch (err) {
16385
16410
  const code = err && typeof err === "object" && "status" in err ? err.status : 1;
16386
16411
  process.exit(code);
@@ -16643,7 +16668,7 @@ function registerRun(program2) {
16643
16668
  }
16644
16669
 
16645
16670
  // src/commands/screenshot/index.ts
16646
- import { execSync as execSync47 } from "child_process";
16671
+ import { execSync as execSync48 } from "child_process";
16647
16672
  import { existsSync as existsSync49, mkdirSync as mkdirSync17, unlinkSync as unlinkSync15, writeFileSync as writeFileSync30 } from "fs";
16648
16673
  import { tmpdir as tmpdir7 } from "os";
16649
16674
  import { join as join51, resolve as resolve13 } from "path";
@@ -16786,7 +16811,7 @@ function runPowerShellScript(processName, outputPath) {
16786
16811
  const scriptPath = join51(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
16787
16812
  writeFileSync30(scriptPath, captureWindowPs1, "utf-8");
16788
16813
  try {
16789
- execSync47(
16814
+ execSync48(
16790
16815
  `powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
16791
16816
  { stdio: ["ignore", "pipe", "pipe"], encoding: "utf-8" }
16792
16817
  );
@@ -17174,7 +17199,7 @@ function syncCommands(claudeDir, targetBase) {
17174
17199
  }
17175
17200
 
17176
17201
  // src/commands/update.ts
17177
- import { execSync as execSync48 } from "child_process";
17202
+ import { execSync as execSync49 } from "child_process";
17178
17203
  import * as path51 from "path";
17179
17204
  function isGlobalNpmInstall(dir) {
17180
17205
  try {
@@ -17182,7 +17207,7 @@ function isGlobalNpmInstall(dir) {
17182
17207
  if (resolved.split(path51.sep).includes("node_modules")) {
17183
17208
  return true;
17184
17209
  }
17185
- const globalPrefix = execSync48("npm prefix -g", { stdio: "pipe" }).toString().trim();
17210
+ const globalPrefix = execSync49("npm prefix -g", { stdio: "pipe" }).toString().trim();
17186
17211
  return resolved.toLowerCase().startsWith(path51.resolve(globalPrefix).toLowerCase());
17187
17212
  } catch {
17188
17213
  return false;
@@ -17193,18 +17218,18 @@ async function update2() {
17193
17218
  console.log(`Assist is installed at: ${installDir}`);
17194
17219
  if (isGitRepo(installDir)) {
17195
17220
  console.log("Detected git repo installation, pulling latest...");
17196
- execSync48("git pull", { cwd: installDir, stdio: "inherit" });
17221
+ execSync49("git pull", { cwd: installDir, stdio: "inherit" });
17197
17222
  console.log("Installing dependencies...");
17198
- execSync48("npm i", { cwd: installDir, stdio: "inherit" });
17223
+ execSync49("npm i", { cwd: installDir, stdio: "inherit" });
17199
17224
  console.log("Building...");
17200
- execSync48("npm run build", { cwd: installDir, stdio: "inherit" });
17225
+ execSync49("npm run build", { cwd: installDir, stdio: "inherit" });
17201
17226
  console.log("Syncing commands...");
17202
- execSync48("assist sync", { stdio: "inherit" });
17227
+ execSync49("assist sync", { stdio: "inherit" });
17203
17228
  } else if (isGlobalNpmInstall(installDir)) {
17204
17229
  console.log("Detected global npm installation, updating...");
17205
- execSync48("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
17230
+ execSync49("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
17206
17231
  console.log("Syncing commands...");
17207
- execSync48("assist sync", { stdio: "inherit" });
17232
+ execSync49("assist sync", { stdio: "inherit" });
17208
17233
  } else {
17209
17234
  console.error(
17210
17235
  "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.239.0",
3
+ "version": "0.239.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {