@staff0rd/assist 0.803.0 → 0.804.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.803.0",
9
+ version: "0.804.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -3122,6 +3122,19 @@ function readSocketLines(socket, onLine) {
3122
3122
  });
3123
3123
  }
3124
3124
 
3125
+ // src/commands/sessions/shared/toAttachments.ts
3126
+ function toAttachments(value) {
3127
+ if (!Array.isArray(value)) return void 0;
3128
+ return value.flatMap((entry) => {
3129
+ const { path: path106, alt, group } = entry ?? {};
3130
+ if (typeof path106 !== "string" || path106 === "") return [];
3131
+ const attachment = { path: path106, alt: typeof alt === "string" ? alt : "" };
3132
+ return [
3133
+ typeof group === "string" && group !== "" ? { ...attachment, group } : attachment
3134
+ ];
3135
+ });
3136
+ }
3137
+
3125
3138
  // src/commands/sessions/shared/toChecklist.ts
3126
3139
  function toChecklist(value) {
3127
3140
  if (!Array.isArray(value)) return void 0;
@@ -3156,14 +3169,6 @@ function toSelection(value) {
3156
3169
  return void 0;
3157
3170
  return { topLeft: selection.topLeft, bottomRight: selection.bottomRight };
3158
3171
  }
3159
- function toAttachments(value) {
3160
- if (!Array.isArray(value)) return void 0;
3161
- return value.flatMap((entry) => {
3162
- const { path: path106, alt } = entry ?? {};
3163
- if (typeof path106 !== "string" || path106 === "") return [];
3164
- return [{ path: path106, alt: typeof alt === "string" ? alt : "" }];
3165
- });
3166
- }
3167
3172
  function toPreviewDecision(msg) {
3168
3173
  if (msg.decision !== "approve" && msg.decision !== "reject") return null;
3169
3174
  return {
@@ -13972,8 +13977,8 @@ function subsequenceScore(text18, query) {
13972
13977
  function scoreFilePath(path106, query) {
13973
13978
  const needle = query.trim().toLowerCase();
13974
13979
  if (!needle) return 0;
13975
- const basename35 = path106.slice(path106.lastIndexOf("/") + 1);
13976
- const inBasename = subsequenceScore(basename35, needle);
13980
+ const basename36 = path106.slice(path106.lastIndexOf("/") + 1);
13981
+ const inBasename = subsequenceScore(basename36, needle);
13977
13982
  if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
13978
13983
  return subsequenceScore(path106, needle);
13979
13984
  }
@@ -29681,15 +29686,34 @@ function parseScreenshotSpecs(specs) {
29681
29686
 
29682
29687
  // src/commands/prs/previewAndApplyEdit.ts
29683
29688
  import { randomUUID as randomUUID16 } from "crypto";
29689
+
29690
+ // src/commands/prs/stageScreenshots.ts
29691
+ import { readFile as readFile8 } from "fs/promises";
29692
+ import { basename as basename23 } from "path";
29693
+ function stageScreenshots(screenshots = []) {
29694
+ return Promise.all(
29695
+ screenshots.map(async (screenshot2) => {
29696
+ const { filePath } = await stageAttachment(
29697
+ basename23(screenshot2.path),
29698
+ attachmentContentType(screenshot2.path),
29699
+ await readFile8(screenshot2.path)
29700
+ );
29701
+ return { ...screenshot2, path: filePath };
29702
+ })
29703
+ );
29704
+ }
29705
+
29706
+ // src/commands/prs/previewAndApplyEdit.ts
29684
29707
  async function previewAndApplyEdit(args) {
29685
29708
  const decision = await awaitPreviewApproval("PR preview", {
29686
29709
  sessionId: args.sessionId,
29687
29710
  requestId: randomUUID16(),
29688
29711
  title: args.title ?? args.currentTitle,
29689
29712
  body: args.body,
29690
- prNumber: args.number
29713
+ prNumber: args.number,
29714
+ screenshots: await stageScreenshots(args.screenshots)
29691
29715
  });
29692
- const attachments = [...args.screenshots, ...decision.screenshots ?? []];
29716
+ const attachments = decision.screenshots ?? [];
29693
29717
  applyEdit(
29694
29718
  args.number,
29695
29719
  args.title,
@@ -30172,12 +30196,10 @@ async function previewAndPlace(args) {
30172
30196
  title: args.title,
30173
30197
  body: args.body,
30174
30198
  prNumber: args.prNumber,
30175
- draft: args.options.draft === true
30199
+ draft: args.options.draft === true,
30200
+ screenshots: await stageScreenshots(args.screenshots)
30176
30201
  });
30177
- const attachments = [
30178
- ...args.screenshots ?? [],
30179
- ...decision.screenshots ?? []
30180
- ];
30202
+ const attachments = decision.screenshots ?? [];
30181
30203
  const body = appendScreenshots(args.body, attachments);
30182
30204
  const options2 = decision.draft === void 0 ? args.options : { ...args.options, draft: decision.draft };
30183
30205
  await placePr(args.prNumber, args.title, body, options2, attachments);
@@ -34834,7 +34856,7 @@ function groupFilesByDirectory(files) {
34834
34856
  }
34835
34857
 
34836
34858
  // src/commands/review/highLevel/buildHighLevelTree.ts
34837
- function basename23(path106) {
34859
+ function basename24(path106) {
34838
34860
  return path106.slice(path106.lastIndexOf("/") + 1);
34839
34861
  }
34840
34862
  function sum(nodes, key) {
@@ -34850,7 +34872,7 @@ function nodesOf(at2, prefix2) {
34850
34872
  const files = at2.files.map(
34851
34873
  (file) => ({
34852
34874
  kind: "file",
34853
- name: basename23(file.path),
34875
+ name: basename24(file.path),
34854
34876
  ...file
34855
34877
  })
34856
34878
  );
@@ -37550,13 +37572,13 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
37550
37572
 
37551
37573
  // src/commands/review/buildReviewPaths.ts
37552
37574
  import { homedir as homedir25 } from "os";
37553
- import { basename as basename24, join as join85 } from "path";
37575
+ import { basename as basename25, join as join85 } from "path";
37554
37576
  function buildReviewPaths(repoRoot2, key) {
37555
37577
  const reviewDir = join85(
37556
37578
  homedir25(),
37557
37579
  ".assist",
37558
37580
  "reviews",
37559
- basename24(repoRoot2),
37581
+ basename25(repoRoot2),
37560
37582
  key
37561
37583
  );
37562
37584
  return {
@@ -39839,7 +39861,7 @@ function list3() {
39839
39861
 
39840
39862
  // src/commands/transcript/move.ts
39841
39863
  import { existsSync as existsSync79, mkdirSync as mkdirSync33, renameSync as renameSync3, writeFileSync as writeFileSync51 } from "fs";
39842
- import { basename as basename28, join as join99 } from "path";
39864
+ import { basename as basename29, join as join99 } from "path";
39843
39865
 
39844
39866
  // src/commands/transcript/convertVttToMarkdown.ts
39845
39867
  function convertVttToMarkdown(inputPath) {
@@ -39860,13 +39882,13 @@ function move(file, options2) {
39860
39882
  process.exit(1);
39861
39883
  }
39862
39884
  const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
39863
- const filename = basename28(file);
39885
+ const filename = basename29(file);
39864
39886
  const sourcePath = join99(vttDir, filename);
39865
39887
  if (!existsSync79(sourcePath)) {
39866
39888
  console.error(`Error: VTT file not found: ${sourcePath}`);
39867
39889
  process.exit(1);
39868
39890
  }
39869
- const base = basename28(filename, ".vtt").replace(/ Transcription$/, "");
39891
+ const base = basename29(filename, ".vtt").replace(/ Transcription$/, "");
39870
39892
  const outputName = `${date} ${base}.md`;
39871
39893
  const formattedDir = join99(transcriptsDir, client);
39872
39894
  mkdirSync33(formattedDir, { recursive: true });
@@ -39880,7 +39902,7 @@ function move(file, options2) {
39880
39902
 
39881
39903
  // src/commands/transcript/merge.ts
39882
39904
  import { existsSync as existsSync80, writeFileSync as writeFileSync52 } from "fs";
39883
- import { basename as basename29 } from "path";
39905
+ import { basename as basename30 } from "path";
39884
39906
 
39885
39907
  // src/commands/transcript/failTranscript.ts
39886
39908
  function failTranscript(message3) {
@@ -40026,7 +40048,7 @@ function readSource3(file) {
40026
40048
  if (!existsSync80(file)) failTranscript(`VTT file not found: ${file}`);
40027
40049
  const cues = readCleanedCues(file);
40028
40050
  if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
40029
- return { path: file, name: basename29(file), cues };
40051
+ return { path: file, name: basename30(file), cues };
40030
40052
  }
40031
40053
  function wholePassages(sources) {
40032
40054
  return sources.map((source) => ({
@@ -40687,7 +40709,7 @@ function listMigrationFiles(dir) {
40687
40709
 
40688
40710
  // src/commands/verify/migrations/readBaselineMigrations.ts
40689
40711
  import { execSync as execSync64 } from "child_process";
40690
- import { basename as basename30 } from "path";
40712
+ import { basename as basename31 } from "path";
40691
40713
  var MIGRATION_FILE3 = /^migration\d+[A-Za-z0-9]*\.ts$/;
40692
40714
  function readBaselineMigrations(repoRelativeDir, ref) {
40693
40715
  const baseline = /* @__PURE__ */ new Map();
@@ -40700,7 +40722,7 @@ function readBaselineMigrations(repoRelativeDir, ref) {
40700
40722
  } catch {
40701
40723
  return baseline;
40702
40724
  }
40703
- const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path106) => MIGRATION_FILE3.test(basename30(path106)));
40725
+ const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path106) => MIGRATION_FILE3.test(basename31(path106)));
40704
40726
  for (const path106 of paths) {
40705
40727
  try {
40706
40728
  const content = execSync64(`git show "${ref}:${path106}"`, {
@@ -40708,7 +40730,7 @@ function readBaselineMigrations(repoRelativeDir, ref) {
40708
40730
  maxBuffer: 16 * 1024 * 1024,
40709
40731
  stdio: ["pipe", "pipe", "pipe"]
40710
40732
  });
40711
- baseline.set(basename30(path106), content);
40733
+ baseline.set(basename31(path106), content);
40712
40734
  } catch {
40713
40735
  }
40714
40736
  }
@@ -43681,7 +43703,7 @@ function setStatus2(session, newStatus) {
43681
43703
 
43682
43704
  // src/commands/sessions/daemon/worktree/reapWorktree.ts
43683
43705
  import { existsSync as existsSync90 } from "fs";
43684
- import { basename as basename31 } from "path";
43706
+ import { basename as basename32 } from "path";
43685
43707
 
43686
43708
  // src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
43687
43709
  import { existsSync as existsSync89 } from "fs";
@@ -43824,7 +43846,7 @@ async function reapWorktree(worktreePath, force = false) {
43824
43846
  const clone = owningClone(worktreePath);
43825
43847
  const removal = await removeTree(clone, worktreePath, force);
43826
43848
  if (!removal.removed) return removal;
43827
- await deleteWorktreeBranch(clone, basename31(worktreePath));
43849
+ await deleteWorktreeBranch(clone, basename32(worktreePath));
43828
43850
  forgetWorktree(worktreePath);
43829
43851
  daemonLog(`worktree ${worktreePath} reaped${force ? " (forced)" : ""}`);
43830
43852
  return removal;
@@ -44320,7 +44342,8 @@ function buildPrPreview(d, kind, prNumber) {
44320
44342
  kind,
44321
44343
  itemType: kind === "backlog-item" ? d.itemType === "bug" ? "bug" : "story" : void 0,
44322
44344
  draft: kind === "pr" && prNumber === null ? draft : void 0,
44323
- metadata: parsePreviewMetadata(d.metadata)
44345
+ metadata: parsePreviewMetadata(d.metadata),
44346
+ screenshots: kind === "pr" ? toAttachments(d.screenshots) : void 0
44324
44347
  };
44325
44348
  }
44326
44349
 
@@ -44407,7 +44430,7 @@ function setPrPreview(sessions, waiters, notify2, client, d) {
44407
44430
  d.draft === true
44408
44431
  );
44409
44432
  daemonLog(
44410
- `pr-preview set: id=${id} requestId=${d.requestId} kind=${kind} target=${target}`
44433
+ `pr-preview set: id=${id} requestId=${d.requestId} kind=${kind} target=${target} screenshots=${session.pendingPrPreview.screenshots?.length ?? 0}`
44411
44434
  );
44412
44435
  notify2();
44413
44436
  }
@@ -46727,7 +46750,7 @@ function rearmStoppedSessions(sessions, notify2) {
46727
46750
 
46728
46751
  // src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
46729
46752
  import { existsSync as existsSync96 } from "fs";
46730
- import { basename as basename33 } from "path";
46753
+ import { basename as basename34 } from "path";
46731
46754
 
46732
46755
  // src/commands/sessions/daemon/worktree/accountedTrees.ts
46733
46756
  function accountedTrees(sessions) {
@@ -46835,7 +46858,7 @@ function capped2(lines2) {
46835
46858
  }
46836
46859
 
46837
46860
  // src/commands/sessions/daemon/worktree/resurfaceOrphanedWorktree.ts
46838
- import { basename as basename32 } from "path";
46861
+ import { basename as basename33 } from "path";
46839
46862
  function resurfaceOrphanedWorktree(sessions, spawnWith, recovered, notify2) {
46840
46863
  const { orphan, reason: reason4, held } = recovered;
46841
46864
  let id;
@@ -46858,7 +46881,7 @@ function orphanedSession(id, recovered) {
46858
46881
  const { orphan, reason: reason4, held } = recovered;
46859
46882
  return {
46860
46883
  ...sessionBase(id, "stopped"),
46861
- name: `recovered ${basename32(orphan.path)}`,
46884
+ name: `recovered ${basename33(orphan.path)}`,
46862
46885
  subtitle: `${held.summary} in ${orphan.path}`,
46863
46886
  commandType: "claude",
46864
46887
  pty: null,
@@ -46919,7 +46942,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
46919
46942
  logVanishedTree(sessions, path106);
46920
46943
  vanished.set(clone, [
46921
46944
  ...vanished.get(clone) ?? [],
46922
- { path: path106, branch: basename33(path106) }
46945
+ { path: path106, branch: basename34(path106) }
46923
46946
  ]);
46924
46947
  continue;
46925
46948
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.803.0",
3
+ "version": "0.804.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {