@staff0rd/assist 0.502.1 → 0.503.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.502.1",
9
+ version: "0.503.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -1787,17 +1787,22 @@ import { execSync as execSync5 } from "child_process";
1787
1787
 
1788
1788
  // src/commands/prs/getPreferredRemoteRepo.ts
1789
1789
  import { execSync as execSync4 } from "child_process";
1790
+
1791
+ // src/commands/prs/parseGitHubUrl.ts
1790
1792
  var GITHUB_URL_PATTERN = /(?:git@github\.com:|https:\/\/github\.com\/)([^/]+)\/([^/]+?)(?:\.git)?\/?$/;
1791
1793
  function parseGitHubUrl(url) {
1792
1794
  const match = url.match(GITHUB_URL_PATTERN);
1793
1795
  if (!match) return null;
1794
1796
  return { org: match[1], repo: match[2] };
1795
1797
  }
1798
+
1799
+ // src/commands/prs/getPreferredRemoteRepo.ts
1796
1800
  function tryGetRemoteUrl(remote, cwd) {
1797
1801
  try {
1798
1802
  return execSync4(`git remote get-url ${remote}`, {
1799
1803
  encoding: "utf8",
1800
1804
  stdio: ["pipe", "pipe", "pipe"],
1805
+ windowsHide: true,
1801
1806
  cwd
1802
1807
  }).trim();
1803
1808
  } catch {
@@ -1808,7 +1813,12 @@ function getCurrentBranchRemote(cwd) {
1808
1813
  try {
1809
1814
  const ref = execSync4(
1810
1815
  "git rev-parse --abbrev-ref --symbolic-full-name @{u}",
1811
- { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], cwd }
1816
+ {
1817
+ encoding: "utf8",
1818
+ stdio: ["pipe", "pipe", "pipe"],
1819
+ windowsHide: true,
1820
+ cwd
1821
+ }
1812
1822
  ).trim();
1813
1823
  const [remote] = ref.split("/", 1);
1814
1824
  return remote || null;
@@ -1821,6 +1831,7 @@ function listRemotes(cwd) {
1821
1831
  return execSync4("git remote", {
1822
1832
  encoding: "utf8",
1823
1833
  stdio: ["pipe", "pipe", "pipe"],
1834
+ windowsHide: true,
1824
1835
  cwd
1825
1836
  }).trim().split("\n").filter(Boolean);
1826
1837
  } catch {
@@ -6516,7 +6527,8 @@ function gitPullBacklog(dir) {
6516
6527
  try {
6517
6528
  execSync29("git pull --ff-only", {
6518
6529
  cwd: dir,
6519
- stdio: ["pipe", "pipe", "pipe"]
6530
+ stdio: ["pipe", "pipe", "pipe"],
6531
+ windowsHide: true
6520
6532
  });
6521
6533
  } catch {
6522
6534
  console.error(
@@ -7672,7 +7684,8 @@ function checkCliAvailable(cli) {
7672
7684
  const binary = cli.split(/\s+/)[0];
7673
7685
  const opts = {
7674
7686
  encoding: "utf8",
7675
- stdio: ["ignore", "pipe", "pipe"]
7687
+ stdio: ["ignore", "pipe", "pipe"],
7688
+ windowsHide: true
7676
7689
  };
7677
7690
  try {
7678
7691
  execSync30(`command -v ${binary}`, opts);
@@ -8974,7 +8987,8 @@ function isGitRepo(dir) {
8974
8987
  try {
8975
8988
  const result = execSync31("git rev-parse --show-toplevel", {
8976
8989
  cwd: dir,
8977
- stdio: "pipe"
8990
+ stdio: "pipe",
8991
+ windowsHide: true
8978
8992
  }).toString().trim();
8979
8993
  return resolve8(result) === resolve8(dir);
8980
8994
  } catch {
@@ -8993,7 +9007,7 @@ import { execSync as execSync32 } from "child_process";
8993
9007
  function tryExec(commands) {
8994
9008
  for (const cmd of commands) {
8995
9009
  try {
8996
- execSync32(cmd, { stdio: "ignore" });
9010
+ execSync32(cmd, { stdio: "ignore", windowsHide: true });
8997
9011
  return true;
8998
9012
  } catch {
8999
9013
  }
@@ -13275,7 +13289,8 @@ function parsePreviewDecision(line, requestId) {
13275
13289
  reason: msg.reason,
13276
13290
  comments: Array.isArray(msg.comments) ? msg.comments : void 0,
13277
13291
  screenshots: Array.isArray(msg.screenshots) ? msg.screenshots : void 0,
13278
- reviewAfter: msg.reviewAfter === true
13292
+ reviewAfter: msg.reviewAfter === true,
13293
+ announceAfter: msg.announceAfter === true
13279
13294
  }
13280
13295
  };
13281
13296
  } catch {
@@ -22076,19 +22091,6 @@ function appendScreenshots(body, screenshots) {
22076
22091
  ${screenshots.join("\n\n")}`;
22077
22092
  }
22078
22093
 
22079
- // src/commands/review/startChainedSession.ts
22080
- async function startChainedSession(label2, start3) {
22081
- if (process.env.ASSIST_SESSION !== "1") return;
22082
- try {
22083
- await start3();
22084
- console.log(`Started ${label2}.`);
22085
- } catch (error) {
22086
- console.error(
22087
- `Warning: could not start ${label2}: ${error instanceof Error ? error.message : String(error)}`
22088
- );
22089
- }
22090
- }
22091
-
22092
22094
  // src/commands/sessions/shared/requestSession.ts
22093
22095
  function parseIncoming(line, type) {
22094
22096
  try {
@@ -22129,29 +22131,80 @@ function requestSession(message3) {
22129
22131
  });
22130
22132
  }
22131
22133
 
22134
+ // src/commands/sessions/shared/requestClaudeSession.ts
22135
+ function requestClaudeSession(prompt, cwd) {
22136
+ return requestSession({ type: "create", prompt, cwd });
22137
+ }
22138
+
22139
+ // src/commands/review/startChainedSession.ts
22140
+ async function startChainedSession(label2, start3) {
22141
+ if (process.env.ASSIST_SESSION !== "1") return;
22142
+ try {
22143
+ await start3();
22144
+ console.log(`Started ${label2}.`);
22145
+ } catch (error) {
22146
+ console.error(
22147
+ `Warning: could not start ${label2}: ${error instanceof Error ? error.message : String(error)}`
22148
+ );
22149
+ }
22150
+ }
22151
+
22152
+ // src/commands/review/announcePr.ts
22153
+ function announcePr(prNumber) {
22154
+ return startChainedSession(
22155
+ `a Slack announce session for PR #${prNumber}`,
22156
+ () => requestClaudeSession(
22157
+ `/prs-slack ${prNumber} --no-confirm`,
22158
+ process.cwd()
22159
+ )
22160
+ );
22161
+ }
22162
+
22132
22163
  // src/commands/sessions/shared/requestAssistSession.ts
22133
22164
  function requestAssistSession(assistArgs, cwd) {
22134
22165
  return requestSession({ type: "create-assist", assistArgs, cwd });
22135
22166
  }
22136
22167
 
22137
22168
  // src/commands/prs/chainReviewAndPost.ts
22138
- function chainReviewAndPost(prNumber) {
22139
- return startChainedSession("a Review + Post session for the PR", () => {
22140
- const number = prNumber ?? findCurrentPrNumber();
22141
- if (number === null)
22142
- throw new Error("no pull request found for the current branch");
22143
- return requestAssistSession(
22144
- [
22145
- "review",
22146
- "--no-prompt",
22147
- "--submit",
22148
- String(number),
22149
- "--address-comments",
22150
- "--announce"
22151
- ],
22152
- process.cwd()
22153
- );
22154
- });
22169
+ function chainReviewAndPost(prNumber, announce) {
22170
+ const args = [
22171
+ "review",
22172
+ "--no-prompt",
22173
+ "--submit",
22174
+ String(prNumber),
22175
+ "--address-comments"
22176
+ ];
22177
+ if (announce) args.push("--announce");
22178
+ return startChainedSession(
22179
+ `a Review + Post session for PR #${prNumber}`,
22180
+ () => requestAssistSession(args, process.cwd())
22181
+ );
22182
+ }
22183
+
22184
+ // src/commands/prs/chainAfterRaise.ts
22185
+ async function chainAfterRaise(prNumber, choice) {
22186
+ const review2 = choice.reviewAfter === true;
22187
+ const announce = choice.announceAfter === true;
22188
+ if (!review2 && !announce) return;
22189
+ if (process.env.ASSIST_SESSION !== "1") return;
22190
+ const number = resolvePrNumber(prNumber);
22191
+ if (number === null) return;
22192
+ if (review2) await chainReviewAndPost(number, announce);
22193
+ else await announcePr(number);
22194
+ }
22195
+ function resolvePrNumber(prNumber) {
22196
+ if (prNumber !== null) return prNumber;
22197
+ try {
22198
+ const found = findCurrentPrNumber();
22199
+ if (found === null) warn("no pull request found for the current branch");
22200
+ return found;
22201
+ } catch (error) {
22202
+ warn(error instanceof Error ? error.message : String(error));
22203
+ return null;
22204
+ }
22205
+ }
22206
+ function warn(reason4) {
22207
+ console.error(`Warning: could not chain sessions after raising: ${reason4}`);
22155
22208
  }
22156
22209
 
22157
22210
  // src/commands/prs/previewAndPlace.ts
@@ -22165,7 +22218,7 @@ async function previewAndPlace(args) {
22165
22218
  });
22166
22219
  const body = appendScreenshots(args.body, decision.screenshots ?? []);
22167
22220
  await placePr(args.prNumber, args.title, body, args.options);
22168
- if (decision.reviewAfter === true) await chainReviewAndPost(args.prNumber);
22221
+ await chainAfterRaise(args.prNumber, decision);
22169
22222
  }
22170
22223
 
22171
22224
  // src/commands/prs/raise.ts
@@ -24799,22 +24852,6 @@ function gatherContext() {
24799
24852
  };
24800
24853
  }
24801
24854
 
24802
- // src/commands/sessions/shared/requestClaudeSession.ts
24803
- function requestClaudeSession(prompt, cwd) {
24804
- return requestSession({ type: "create", prompt, cwd });
24805
- }
24806
-
24807
- // src/commands/review/announcePr.ts
24808
- function announcePr(prNumber) {
24809
- return startChainedSession(
24810
- `a Slack announce session for PR #${prNumber}`,
24811
- () => requestClaudeSession(
24812
- `/prs-slack ${prNumber} --no-confirm`,
24813
- process.cwd()
24814
- )
24815
- );
24816
- }
24817
-
24818
24855
  // src/commands/review/postReviewToPr.ts
24819
24856
  import { readFileSync as readFileSync41 } from "fs";
24820
24857
 
@@ -29999,7 +30036,7 @@ function decidePrPreview(sessions, waiters, notify2, d) {
29999
30036
  const commentCount = Array.isArray(d.comments) ? d.comments.length : 0;
30000
30037
  const screenshotCount = Array.isArray(d.screenshots) ? d.screenshots.length : 0;
30001
30038
  daemonLog(
30002
- `pr-decision received: id=${id} requestId=${requestId} decision=${d.decision} comments=${commentCount} screenshots=${screenshotCount} reviewAfter=${d.reviewAfter === true}`
30039
+ `pr-decision received: id=${id} requestId=${requestId} decision=${d.decision} comments=${commentCount} screenshots=${screenshotCount} reviewAfter=${d.reviewAfter === true} announceAfter=${d.announceAfter === true}`
30003
30040
  );
30004
30041
  const waiter = waiters.get(id);
30005
30042
  if (waiter)
@@ -30010,7 +30047,8 @@ function decidePrPreview(sessions, waiters, notify2, d) {
30010
30047
  reason: d.reason,
30011
30048
  comments: d.comments,
30012
30049
  screenshots: d.screenshots,
30013
- reviewAfter: d.reviewAfter
30050
+ reviewAfter: d.reviewAfter,
30051
+ announceAfter: d.announceAfter
30014
30052
  });
30015
30053
  waiters.delete(id);
30016
30054
  session.pendingPrPreview = void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.502.1",
3
+ "version": "0.503.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {