@staff0rd/assist 0.1185.5 → 0.1187.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.
Files changed (26) hide show
  1. package/agent/commands/github.md +2 -1
  2. package/dist/.build-files +19 -20
  3. package/dist/built-version +1 -1
  4. package/dist/{chunk-CXJX4ZT5.js → chunk-7GGVRB3G.js} +1 -1
  5. package/dist/{chunk-WG3TXZMV.js → chunk-DPCFT55U.js} +16 -6
  6. package/dist/{chunk-5JNKJSKT.js → chunk-GIFMD6SW.js} +5 -7
  7. package/dist/{chunk-BWUPBQ3H.js → chunk-GYM3LVZT.js} +1 -1
  8. package/dist/{chunk-SOES6K5E.js → chunk-ODH4PKV4.js} +1 -1
  9. package/dist/{chunk-UY3SFWNC.js → chunk-PEOCY7Q3.js} +1 -1
  10. package/dist/{chunk-MJ4RLQ5N.js → chunk-Q4TGGE5L.js} +0 -63
  11. package/dist/{chunk-LXLLU5Z6.js → chunk-XNN2K4S3.js} +1 -1
  12. package/dist/{chunk-ONODYZ2H.js → chunk-YDSX6BYY.js} +65 -4
  13. package/dist/commands/sessions/web/bundle.js +162 -162
  14. package/dist/{createIssue-5KNMMJVA.js → createIssue-ZFRBIC7A.js} +42 -35
  15. package/dist/{doctorNodes-V45AR2P2.js → doctorNodes-Y5L32TWX.js} +3 -3
  16. package/dist/{edit-5QLQ3TLJ.js → edit-2ZO7TOPW.js} +6 -7
  17. package/dist/index.js +33 -28
  18. package/dist/{raise-O7DVXVP6.js → raise-WQ2WINT4.js} +6 -7
  19. package/dist/{restartNode-N6OZKO6D.js → restartNode-CAPDQK23.js} +5 -5
  20. package/dist/{runDaemon-LVDERT3K.js → runDaemon-GHG5TRPX.js} +2 -2
  21. package/dist/{signExtension-2JTTOCVB.js → signExtension-GQXLL6CC.js} +1 -1
  22. package/dist/{updateNode-DWMJM2ML.js → updateNode-RMHEOL4X.js} +5 -5
  23. package/dist/{web-2FBWHQMJ.js → web-3NKRW2FS.js} +6 -7
  24. package/dist/{web-TNILCTTL.js → web-IE3MFOE5.js} +6 -7
  25. package/package.json +1 -1
  26. package/dist/chunk-S6FVZYHH.js +0 -16
@@ -83,13 +83,14 @@ Create a new issue from a free-form request (e.g. `create bug against owner/repo
83
83
 
84
84
  - **Milestone** — the milestone's title, passed as named; the command matches it against the repo's open milestones.
85
85
  - **Type** and **parent** — only if the request names them.
86
+ - **Screenshots** — when you already have an image or video to include (e.g. a file the user pointed at on disk), pass it with `--screenshot '[Group/]Caption=path'`, once per file, rather than asking the user to drop it into the preview. It is attached under `## Screenshots` for you.
86
87
 
87
88
  If a named project, label or milestone doesn't match, list the available ones and ask the user which they meant (or whether to drop it). Never guess a near match or silently omit it. For a milestone, check `gh api repos/<owner>/<repo>/milestones --jq '.[].title'` before running, or relay the list the command prints when it rejects the name.
88
89
 
89
90
  Then run the command bare, as a background task, and do no other work until it returns — in a web session it blocks on the preview pane until the user approves or rejects:
90
91
 
91
92
  ```
92
- assist github issue create -R <owner>/<repo> --title "<title>" --body "<body>" [--label <name>]... [--project <number>] [--status <name>] [--milestone <name>] [--type <name>] [--parent <issue>] 2>&1
93
+ assist github issue create -R <owner>/<repo> --title "<title>" --body "<body>" [--label <name>]... [--project <number>] [--status <name>] [--milestone <name>] [--type <name>] [--parent <issue>] [--screenshot '[Group/]Caption=path']... 2>&1
93
94
  ```
94
95
 
95
96
  Every option is resolved before the preview, so an unknown name creates nothing. Relay the outcome:
package/dist/.build-files CHANGED
@@ -60,7 +60,6 @@ chunk-556BOFTS.js
60
60
  chunk-56USVTPP.js
61
61
  chunk-5CNDLMYO.js
62
62
  chunk-5H7EHZ3J.js
63
- chunk-5JNKJSKT.js
64
63
  chunk-5JOVEUBS.js
65
64
  chunk-5MJTFJGT.js
66
65
  chunk-5QM5VR3J.js
@@ -82,6 +81,7 @@ chunk-6VCFPUNV.js
82
81
  chunk-6Z7XJJNZ.js
83
82
  chunk-7DSWCPDZ.js
84
83
  chunk-7F22C6MC.js
84
+ chunk-7GGVRB3G.js
85
85
  chunk-7HNRCA3N.js
86
86
  chunk-7KDF6H4R.js
87
87
  chunk-7KVL2L7Z.js
@@ -116,7 +116,6 @@ chunk-BFQSGIN6.js
116
116
  chunk-BJNES5JB.js
117
117
  chunk-BO5JCCC5.js
118
118
  chunk-BVHK2VVT.js
119
- chunk-BWUPBQ3H.js
120
119
  chunk-BXGPF3TG.js
121
120
  chunk-C3MGHR3N.js
122
121
  chunk-C6C5BLVW.js
@@ -126,13 +125,13 @@ chunk-CDU6M5IX.js
126
125
  chunk-CGYVYHMM.js
127
126
  chunk-CPJ3KOSP.js
128
127
  chunk-CUOHHT2F.js
129
- chunk-CXJX4ZT5.js
130
128
  chunk-D454WT4M.js
131
129
  chunk-D6WBUFXT.js
132
130
  chunk-D7UZLH36.js
133
131
  chunk-DGQ7KOW4.js
134
132
  chunk-DIAC4XYA.js
135
133
  chunk-DISNKALJ.js
134
+ chunk-DPCFT55U.js
136
135
  chunk-DS2YJZZY.js
137
136
  chunk-DUNO7WBT.js
138
137
  chunk-DZBGDSCK.js
@@ -164,6 +163,7 @@ chunk-FYYZG4GY.js
164
163
  chunk-FZDQG67V.js
165
164
  chunk-G3CJH2XK.js
166
165
  chunk-G3ROBZ4I.js
166
+ chunk-GIFMD6SW.js
167
167
  chunk-GIHVMELY.js
168
168
  chunk-GL5GKF5A.js
169
169
  chunk-GNNMJOUE.js
@@ -171,6 +171,7 @@ chunk-GQF23TWI.js
171
171
  chunk-GRXFWFGP.js
172
172
  chunk-GVI4JSG7.js
173
173
  chunk-GVVK5XFZ.js
174
+ chunk-GYM3LVZT.js
174
175
  chunk-H2KHIEQF.js
175
176
  chunk-H63MI5HI.js
176
177
  chunk-H7EUPSJB.js
@@ -230,12 +231,10 @@ chunk-LMHILP5H.js
230
231
  chunk-LOP6Y256.js
231
232
  chunk-LSBUNT4X.js
232
233
  chunk-LTETA6J4.js
233
- chunk-LXLLU5Z6.js
234
234
  chunk-M3O2BTJG.js
235
235
  chunk-M6MAQU3Z.js
236
236
  chunk-MFTQLD5M.js
237
237
  chunk-MJ44T7R4.js
238
- chunk-MJ4RLQ5N.js
239
238
  chunk-MJLABLH5.js
240
239
  chunk-MRUIXQXS.js
241
240
  chunk-MT2LAO3P.js
@@ -257,9 +256,9 @@ chunk-NZYSENRR.js
257
256
  chunk-O3SCSMQJ.js
258
257
  chunk-O6HFT23O.js
259
258
  chunk-O6RBWPG2.js
259
+ chunk-ODH4PKV4.js
260
260
  chunk-ODLSWRTS.js
261
261
  chunk-OLE7XSNB.js
262
- chunk-ONODYZ2H.js
263
262
  chunk-OQ6AYXHB.js
264
263
  chunk-ORSRBZ2X.js
265
264
  chunk-OU6Q5ZS3.js
@@ -272,10 +271,12 @@ chunk-P56S7RYB.js
272
271
  chunk-P7FVAGFQ.js
273
272
  chunk-PB3F4XB3.js
274
273
  chunk-PDXOHW2M.js
274
+ chunk-PEOCY7Q3.js
275
275
  chunk-PIDKNOD6.js
276
276
  chunk-PNDUTAZR.js
277
277
  chunk-PURNABFX.js
278
278
  chunk-PZAEU7LL.js
279
+ chunk-Q4TGGE5L.js
279
280
  chunk-Q6PZLPK4.js
280
281
  chunk-Q7YVMIA3.js
281
282
  chunk-QAJUCN3A.js
@@ -301,12 +302,10 @@ chunk-RWVRH774.js
301
302
  chunk-RXFNQQZC.js
302
303
  chunk-RXKI4XAU.js
303
304
  chunk-RZBCBCNG.js
304
- chunk-S6FVZYHH.js
305
305
  chunk-S6XYTJU2.js
306
306
  chunk-SDMBTSYP.js
307
307
  chunk-SHWMHL7S.js
308
308
  chunk-SN2GTNL4.js
309
- chunk-SOES6K5E.js
310
309
  chunk-SQX66MN6.js
311
310
  chunk-SSKHLBQB.js
312
311
  chunk-SSOJWOYS.js
@@ -334,7 +333,6 @@ chunk-UN4ABKA7.js
334
333
  chunk-UP6QV5BJ.js
335
334
  chunk-UPGNKZVA.js
336
335
  chunk-USKD27FY.js
337
- chunk-UY3SFWNC.js
338
336
  chunk-UYSNEOWQ.js
339
337
  chunk-V3AWLJ7P.js
340
338
  chunk-VABNWHSE.js
@@ -352,7 +350,6 @@ chunk-W5FPQALS.js
352
350
  chunk-W6UBSIJA.js
353
351
  chunk-W7TRZLEM.js
354
352
  chunk-WDODIKZ4.js
355
- chunk-WG3TXZMV.js
356
353
  chunk-WGDN4CNI.js
357
354
  chunk-WOGUXGZS.js
358
355
  chunk-WTONCI74.js
@@ -368,6 +365,7 @@ chunk-XDIVXGPQ.js
368
365
  chunk-XEJODD6D.js
369
366
  chunk-XJTXAL22.js
370
367
  chunk-XNCJ3OIJ.js
368
+ chunk-XNN2K4S3.js
371
369
  chunk-XSJGIJEE.js
372
370
  chunk-XT3AOF2P.js
373
371
  chunk-XTPBXBZA.js
@@ -381,6 +379,7 @@ chunk-XZT5S5IY.js
381
379
  chunk-Y3R4C2P7.js
382
380
  chunk-YCFOCDUA.js
383
381
  chunk-YDA62L6J.js
382
+ chunk-YDSX6BYY.js
384
383
  chunk-YHJHYOBF.js
385
384
  chunk-YIBSK5OC.js
386
385
  chunk-YJ72SXVD.js
@@ -464,7 +463,7 @@ configSet-NMSZ27OX.js
464
463
  configUnset-IINMDUOO.js
465
464
  configure-M2ECXTUT.js
466
465
  coverage-G7J25BUX.js
467
- createIssue-5KNMMJVA.js
466
+ createIssue-ZFRBIC7A.js
468
467
  cyclomatic-CYUIP7H3.js
469
468
  daemonStatus-EAZHBC6O.js
470
469
  del-6CB5KFFD.js
@@ -476,11 +475,11 @@ deps-RSUOIZPE.js
476
475
  docsConfirm-AQGXUXUM.js
477
476
  docsScreenshots-VV5F5SK5.js
478
477
  docsUnlock-27IXZHHP.js
479
- doctorNodes-V45AR2P2.js
478
+ doctorNodes-Y5L32TWX.js
480
479
  done-3VAD7V2R.js
481
480
  drainDaemon-ZHP2VY7D.js
482
481
  dropRetiredTables-JBLALSG5.js
483
- edit-5QLQ3TLJ.js
482
+ edit-2ZO7TOPW.js
484
483
  editHook-S6MCRMW4.js
485
484
  editIssue-MPKFMOLQ.js
486
485
  editIssueComment-3E3SBBJE.js
@@ -556,7 +555,7 @@ prs-2SRUKVTI.js
556
555
  prsSlackChannel-QGXDVDOM.js
557
556
  prsStatus-6G3ZTK36.js
558
557
  pullIfConfigured-ATTGJC3C.js
559
- raise-O7DVXVP6.js
558
+ raise-WQ2WINT4.js
560
559
  raiseHelpText-IDZI3UAC.js
561
560
  ravendbAuth-QCLMPEJ3.js
562
561
  ravendbCollections-L4H5PMFE.js
@@ -583,7 +582,7 @@ repos-HRCIMY6J.js
583
582
  resolveHarness-ADZRYQZA.js
584
583
  resolveModel-2OGVGUM3.js
585
584
  restartDaemon-Y7V2QF3N.js
586
- restartNode-N6OZKO6D.js
585
+ restartNode-CAPDQK23.js
587
586
  restructure-OGGDZTXX.js
588
587
  review-5635HCXL.js
589
588
  reviewPrComments-E5Y5AQ7D.js
@@ -591,7 +590,7 @@ rewindPhase-S6NGWRFK.js
591
590
  rulesAdd-75UVUUDX.js
592
591
  run-TSPTUSMX.js
593
592
  run-ZRNTAO7O.js
594
- runDaemon-LVDERT3K.js
593
+ runDaemon-GHG5TRPX.js
595
594
  runExtract-ALNQ3I3T.js
596
595
  runParallelPhase-V2LPUTA3.js
597
596
  runRefine-DSGHXEKJ.js
@@ -613,7 +612,7 @@ show-INQEZ755.js
613
612
  show-WD57SDPL.js
614
613
  showClaudeCodeIcon-E4SAM3GN.js
615
614
  showCodexIcon-YUAKV4NI.js
616
- signExtension-2JTTOCVB.js
615
+ signExtension-GQXLL6CC.js
617
616
  simulateDivergence-VB4UL4UR.js
618
617
  skip-7Q3IVOBV.js
619
618
  slack-DX2FRJ7S.js
@@ -641,7 +640,7 @@ unlinkNode-RKC44U2T.js
641
640
  unstar-YQDZUJV7.js
642
641
  update-FHGTCK6N.js
643
642
  update-W7ANHGDR.js
644
- updateNode-DWMJM2ML.js
643
+ updateNode-RMHEOL4X.js
645
644
  updatePhase-JEVJRAOR.js
646
645
  updatePlan-PYKAHGKE.js
647
646
  version-W7VP7LDJ.js
@@ -649,8 +648,8 @@ viewIssue-CYHIPCFO.js
649
648
  watchLoop-MV7DVGC6.js
650
649
  watchReport-A4W7UOAJ.js
651
650
  watchWait-5Y2J5VQY.js
652
- web-2FBWHQMJ.js
653
- web-TNILCTTL.js
651
+ web-3NKRW2FS.js
652
+ web-IE3MFOE5.js
654
653
  withPool-LEJ76IOJ.js
655
654
  wontdo-XAQGHSR5.js
656
655
  wontfix-W2DXPEE4.js
@@ -1 +1 @@
1
- 0.1185.5
1
+ 0.1187.0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  buildDoctorProbes,
3
3
  diagnoseLink
4
- } from "./chunk-SOES6K5E.js";
4
+ } from "./chunk-ODH4PKV4.js";
5
5
  import {
6
6
  findLinkSpec
7
7
  } from "./chunk-J2PPCMCR.js";
@@ -1,6 +1,14 @@
1
- import {
2
- stagedAttachmentsDir
3
- } from "./chunk-S6FVZYHH.js";
1
+ // src/shared/stagedAttachmentsDir.ts
2
+ import { homedir } from "os";
3
+ import { join } from "path";
4
+ var stagedAttachmentsDir = join(homedir(), ".assist", "attachments");
5
+
6
+ // src/shared/isStagedAttachmentPath.ts
7
+ import { isAbsolute, relative, resolve, sep } from "path";
8
+ function isStagedAttachmentPath(path) {
9
+ const rel = relative(stagedAttachmentsDir, resolve(path));
10
+ return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
11
+ }
4
12
 
5
13
  // src/commands/sessions/web/attachmentContentType.ts
6
14
  import { extname } from "path";
@@ -32,7 +40,7 @@ var ghAttachableExtensions = /* @__PURE__ */ new Set([
32
40
 
33
41
  // src/commands/sessions/web/stageAttachment.ts
34
42
  import { mkdir, mkdtemp, writeFile } from "fs/promises";
35
- import { extname as extname2, join } from "path";
43
+ import { extname as extname2, join as join2 } from "path";
36
44
  function extensionFromMime(contentType) {
37
45
  const mime = contentType.split(";")[0].trim().toLowerCase();
38
46
  const known = attachmentMimeTypes[mime];
@@ -56,14 +64,16 @@ function safeBaseName(name) {
56
64
  async function stageAttachment(name, contentType, body) {
57
65
  const ext = pickExtension(name, contentType);
58
66
  await mkdir(stagedAttachmentsDir, { recursive: true });
59
- const dir = await mkdtemp(join(stagedAttachmentsDir, "upload-"));
67
+ const dir = await mkdtemp(join2(stagedAttachmentsDir, "upload-"));
60
68
  const alt = safeBaseName(name);
61
- const filePath = join(dir, `${alt}.${ext}`);
69
+ const filePath = join2(dir, `${alt}.${ext}`);
62
70
  await writeFile(filePath, body);
63
71
  return { dir, filePath, alt };
64
72
  }
65
73
 
66
74
  export {
75
+ stagedAttachmentsDir,
76
+ isStagedAttachmentPath,
67
77
  attachmentContentType,
68
78
  ghAttachableExtensions,
69
79
  stageAttachment
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-JM57BCD6.js";
11
11
  import {
12
12
  firstBrokenHop
13
- } from "./chunk-CXJX4ZT5.js";
13
+ } from "./chunk-7GGVRB3G.js";
14
14
  import {
15
15
  describePeerError,
16
16
  fetchPeerJson
@@ -47,7 +47,7 @@ import {
47
47
  import {
48
48
  ASSIST_VERSION,
49
49
  PROTOCOL_VERSION
50
- } from "./chunk-BWUPBQ3H.js";
50
+ } from "./chunk-GYM3LVZT.js";
51
51
  import {
52
52
  findLinkSpec
53
53
  } from "./chunk-J2PPCMCR.js";
@@ -115,10 +115,6 @@ import {
115
115
  import {
116
116
  requestPromptSession
117
117
  } from "./chunk-XTQSKMFH.js";
118
- import {
119
- attachmentContentType,
120
- stageAttachment
121
- } from "./chunk-WG3TXZMV.js";
122
118
  import {
123
119
  isDoNotMerge
124
120
  } from "./chunk-NGTSPXSJ.js";
@@ -146,9 +142,11 @@ import {
146
142
  fetchProjectV2
147
143
  } from "./chunk-YQ3CNWB3.js";
148
144
  import {
145
+ attachmentContentType,
149
146
  isStagedAttachmentPath,
147
+ stageAttachment,
150
148
  stagedAttachmentsDir
151
- } from "./chunk-S6FVZYHH.js";
149
+ } from "./chunk-DPCFT55U.js";
152
150
  import {
153
151
  assignIssueToSelf
154
152
  } from "./chunk-SDMBTSYP.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-5CNDLMYO.js";
4
4
  import {
5
5
  package_default
6
- } from "./chunk-LXLLU5Z6.js";
6
+ } from "./chunk-XNN2K4S3.js";
7
7
  import {
8
8
  loadConfig
9
9
  } from "./chunk-UFSOFNXQ.js";
@@ -14,7 +14,7 @@ import {
14
14
  isHello,
15
15
  linkVersionCheck,
16
16
  negotiateProtocol
17
- } from "./chunk-BWUPBQ3H.js";
17
+ } from "./chunk-GYM3LVZT.js";
18
18
 
19
19
  // src/commands/sessions/nodes/probePeerHello.ts
20
20
  var HELLO_TIMEOUT_MS = 5e3;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  firstBrokenHop
3
- } from "./chunk-CXJX4ZT5.js";
3
+ } from "./chunk-7GGVRB3G.js";
4
4
  import {
5
5
  describePeerError
6
6
  } from "./chunk-VABNWHSE.js";
@@ -4,55 +4,10 @@ import {
4
4
  import {
5
5
  normalizeGithubIssue
6
6
  } from "./chunk-FVZP4ULO.js";
7
- import {
8
- attachmentContentType,
9
- ghAttachableExtensions,
10
- stageAttachment
11
- } from "./chunk-WG3TXZMV.js";
12
7
  import {
13
8
  loadJson
14
9
  } from "./chunk-CGYVYHMM.js";
15
10
 
16
- // src/commands/prs/parseScreenshotSpec.ts
17
- import { statSync } from "fs";
18
- import { basename, extname, resolve } from "path";
19
- function splitOnce(value, separator) {
20
- const index = value.indexOf(separator);
21
- if (index === -1) return null;
22
- return [value.slice(0, index), value.slice(index + separator.length)];
23
- }
24
- function isFile(path) {
25
- try {
26
- return statSync(path).isFile();
27
- } catch {
28
- return false;
29
- }
30
- }
31
- function parseScreenshotSpec(spec) {
32
- const [label, rawPath] = splitOnce(spec, "=") ?? ["", spec];
33
- const [group, caption] = splitOnce(label, "/") ?? ["", label];
34
- const path = resolve(rawPath.trim());
35
- const ext = extname(path).replace(/^\./, "").toLowerCase();
36
- if (!isFile(path))
37
- throw new Error(`--screenshot '${spec}': file not found: ${path}`);
38
- if (!ghAttachableExtensions.has(ext))
39
- throw new Error(
40
- `--screenshot '${spec}': gh cannot attach .${ext || "(none)"} files (supported: ${[...ghAttachableExtensions].join(", ")}).`
41
- );
42
- const alt = caption.trim() || basename(path, extname(path));
43
- return group.trim() ? { path, alt, group: group.trim() } : { path, alt };
44
- }
45
-
46
- // src/commands/prs/parseScreenshotSpecs.ts
47
- function parseScreenshotSpecs(specs) {
48
- try {
49
- return (specs ?? []).map(parseScreenshotSpec);
50
- } catch (error) {
51
- console.error(`Error: ${error.message}`);
52
- process.exit(1);
53
- }
54
- }
55
-
56
11
  // src/commands/prs/findWallOfText.ts
57
12
  var MAX_PARAGRAPH_CHARS = 600;
58
13
  var MAX_PARAGRAPH_SENTENCES = 4;
@@ -152,26 +107,8 @@ ${sections.how}`);
152
107
  return parts.join("\n\n");
153
108
  }
154
109
 
155
- // src/commands/prs/stageScreenshots.ts
156
- import { readFile } from "fs/promises";
157
- import { basename as basename2 } from "path";
158
- function stageScreenshots(screenshots = []) {
159
- return Promise.all(
160
- screenshots.map(async (screenshot) => {
161
- const { filePath } = await stageAttachment(
162
- basename2(screenshot.path),
163
- attachmentContentType(screenshot.path),
164
- await readFile(screenshot.path)
165
- );
166
- return { ...screenshot, path: filePath };
167
- })
168
- );
169
- }
170
-
171
110
  export {
172
111
  renderWhy,
173
112
  buildPrBody,
174
- parseScreenshotSpecs,
175
- stageScreenshots,
176
113
  validatePrContent
177
114
  };
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@staff0rd/assist",
4
- version: "0.1185.5",
4
+ version: "0.1187.0",
5
5
  type: "module",
6
6
  main: "dist/index.js",
7
7
  bin: {
@@ -2,8 +2,11 @@ import {
2
2
  minGhAttachVersion
3
3
  } from "./chunk-B7B26YPF.js";
4
4
  import {
5
- isStagedAttachmentPath
6
- } from "./chunk-S6FVZYHH.js";
5
+ attachmentContentType,
6
+ ghAttachableExtensions,
7
+ isStagedAttachmentPath,
8
+ stageAttachment
9
+ } from "./chunk-DPCFT55U.js";
7
10
 
8
11
  // src/commands/prs/renderScreenshotBlock.ts
9
12
  import { extname } from "path";
@@ -82,6 +85,62 @@ function appendScreenshots(body, attachments) {
82
85
  ${section}` : section;
83
86
  }
84
87
 
88
+ // src/commands/prs/parseScreenshotSpec.ts
89
+ import { statSync } from "fs";
90
+ import { basename, extname as extname2, resolve } from "path";
91
+ function splitOnce(value, separator) {
92
+ const index = value.indexOf(separator);
93
+ if (index === -1) return null;
94
+ return [value.slice(0, index), value.slice(index + separator.length)];
95
+ }
96
+ function isFile(path) {
97
+ try {
98
+ return statSync(path).isFile();
99
+ } catch {
100
+ return false;
101
+ }
102
+ }
103
+ function parseScreenshotSpec(spec) {
104
+ const [label, rawPath] = splitOnce(spec, "=") ?? ["", spec];
105
+ const [group, caption] = splitOnce(label, "/") ?? ["", label];
106
+ const path = resolve(rawPath.trim());
107
+ const ext = extname2(path).replace(/^\./, "").toLowerCase();
108
+ if (!isFile(path))
109
+ throw new Error(`--screenshot '${spec}': file not found: ${path}`);
110
+ if (!ghAttachableExtensions.has(ext))
111
+ throw new Error(
112
+ `--screenshot '${spec}': gh cannot attach .${ext || "(none)"} files (supported: ${[...ghAttachableExtensions].join(", ")}).`
113
+ );
114
+ const alt = caption.trim() || basename(path, extname2(path));
115
+ return group.trim() ? { path, alt, group: group.trim() } : { path, alt };
116
+ }
117
+
118
+ // src/commands/prs/parseScreenshotSpecs.ts
119
+ function parseScreenshotSpecs(specs) {
120
+ try {
121
+ return (specs ?? []).map(parseScreenshotSpec);
122
+ } catch (error) {
123
+ console.error(`Error: ${error.message}`);
124
+ process.exit(1);
125
+ }
126
+ }
127
+
128
+ // src/commands/prs/stageScreenshots.ts
129
+ import { readFile } from "fs/promises";
130
+ import { basename as basename2 } from "path";
131
+ function stageScreenshots(screenshots = []) {
132
+ return Promise.all(
133
+ screenshots.map(async (screenshot) => {
134
+ const { filePath } = await stageAttachment(
135
+ basename2(screenshot.path),
136
+ attachmentContentType(screenshot.path),
137
+ await readFile(screenshot.path)
138
+ );
139
+ return { ...screenshot, path: filePath };
140
+ })
141
+ );
142
+ }
143
+
85
144
  // src/commands/prs/attachArgs.ts
86
145
  function attachArgs(attachments) {
87
146
  return attachments.flatMap(({ path }) => ["--attach", path]);
@@ -89,7 +148,7 @@ function attachArgs(attachments) {
89
148
 
90
149
  // src/commands/prs/runGhWithAttachments.ts
91
150
  import { execFileSync } from "child_process";
92
- import { basename } from "path";
151
+ import { basename as basename3 } from "path";
93
152
 
94
153
  // src/shared/removeStagedAttachments.ts
95
154
  import { rmSync } from "fs";
@@ -106,7 +165,7 @@ function removeStagedAttachments(attachments) {
106
165
  var PLACED_URL = /https:\/\/\S+\/(pull|issues)\/\d+/;
107
166
  function reportPartialFailure(attachments, stderr) {
108
167
  const failed = attachments.filter(
109
- ({ path }) => stderr.includes(path) || stderr.includes(basename(path))
168
+ ({ path }) => stderr.includes(path) || stderr.includes(basename3(path))
110
169
  );
111
170
  const named = failed.length > 0 ? failed : attachments;
112
171
  console.error(
@@ -141,6 +200,8 @@ function runGhWithAttachments(args, attachments) {
141
200
 
142
201
  export {
143
202
  appendScreenshots,
203
+ parseScreenshotSpecs,
204
+ stageScreenshots,
144
205
  attachArgs,
145
206
  runGhWithAttachments
146
207
  };