@@ -171,9 +171,7 @@ try {
171171 const summary = await summarize ( response )
172172 await pushToLocalBranch ( summary )
173173 }
174- const hasShared = prData . comments . nodes . some ( ( c ) =>
175- c . body . includes ( `${ useShareUrl ( ) } /s/${ shareId } ` ) ,
176- )
174+ const hasShared = prData . comments . nodes . some ( ( c ) => c . body . includes ( `${ useShareUrl ( ) } /s/${ shareId } ` ) )
177175 await updateComment ( `${ response } ${ footer ( { image : ! hasShared } ) } ` )
178176 }
179177 // Fork PR
@@ -185,9 +183,7 @@ try {
185183 const summary = await summarize ( response )
186184 await pushToForkBranch ( summary , prData )
187185 }
188- const hasShared = prData . comments . nodes . some ( ( c ) =>
189- c . body . includes ( `${ useShareUrl ( ) } /s/${ shareId } ` ) ,
190- )
186+ const hasShared = prData . comments . nodes . some ( ( c ) => c . body . includes ( `${ useShareUrl ( ) } /s/${ shareId } ` ) )
191187 await updateComment ( `${ response } ${ footer ( { image : ! hasShared } ) } ` )
192188 }
193189 }
@@ -368,9 +364,7 @@ async function getAccessToken() {
368364
369365 if ( ! response . ok ) {
370366 const responseJson = ( await response . json ( ) ) as { error ?: string }
371- throw new Error (
372- `App token exchange failed: ${ response . status } ${ response . statusText } - ${ responseJson . error } ` ,
373- )
367+ throw new Error ( `App token exchange failed: ${ response . status } ${ response . statusText } - ${ responseJson . error } ` )
374368 }
375369
376370 const responseJson = ( await response . json ( ) ) as { token : string }
@@ -411,12 +405,8 @@ async function getUserPrompt() {
411405 // ie. <img alt="Image" src="https://github.com/user-attachments/assets/xxxx" />
412406 // ie. [api.json](https://github.com/user-attachments/files/21433810/api.json)
413407 // ie. 
414- const mdMatches = prompt . matchAll (
415- / ! ? \[ .* ?\] \( ( h t t p s : \/ \/ g i t h u b \. c o m \/ u s e r - a t t a c h m e n t s \/ [ ^ ) ] + ) \) / gi,
416- )
417- const tagMatches = prompt . matchAll (
418- / < i m g .* ?s r c = " ( h t t p s : \/ \/ g i t h u b \. c o m \/ u s e r - a t t a c h m e n t s \/ [ ^ " ] + ) " \/ > / gi,
419- )
408+ const mdMatches = prompt . matchAll ( / ! ? \[ .* ?\] \( ( h t t p s : \/ \/ g i t h u b \. c o m \/ u s e r - a t t a c h m e n t s \/ [ ^ ) ] + ) \) / gi)
409+ const tagMatches = prompt . matchAll ( / < i m g .* ?s r c = " ( h t t p s : \/ \/ g i t h u b \. c o m \/ u s e r - a t t a c h m e n t s \/ [ ^ " ] + ) " \/ > / gi)
420410 const matches = [ ...mdMatches , ...tagMatches ] . sort ( ( a , b ) => a . index - b . index )
421411 console . log ( "Images" , JSON . stringify ( matches , null , 2 ) )
422412
@@ -443,8 +433,7 @@ async function getUserPrompt() {
443433
444434 // Replace img tag with file path, ie. @image.png
445435 const replacement = `@${ filename } `
446- prompt =
447- prompt . slice ( 0 , start + offset ) + replacement + prompt . slice ( start + offset + tag . length )
436+ prompt = prompt . slice ( 0 , start + offset ) + replacement + prompt . slice ( start + offset + tag . length )
448437 offset += replacement . length - tag . length
449438
450439 const contentType = res . headers . get ( "content-type" )
@@ -512,12 +501,7 @@ async function subscribeSessionEvents() {
512501 ? JSON . stringify ( part . state . input )
513502 : "Unknown"
514503 console . log ( )
515- console . log (
516- color + `|` ,
517- "\x1b[0m\x1b[2m" + ` ${ tool . padEnd ( 7 , " " ) } ` ,
518- "" ,
519- "\x1b[0m" + title ,
520- )
504+ console . log ( color + `|` , "\x1b[0m\x1b[2m" + ` ${ tool . padEnd ( 7 , " " ) } ` , "" , "\x1b[0m" + title )
521505 }
522506
523507 if ( part . type === "text" ) {
@@ -729,8 +713,7 @@ async function assertPermissions() {
729713 throw new Error ( `Failed to check permissions for user ${ actor } : ${ error } ` )
730714 }
731715
732- if ( ! [ "admin" , "write" ] . includes ( permission ) )
733- throw new Error ( `User ${ actor } does not have write permissions` )
716+ if ( ! [ "admin" , "write" ] . includes ( permission ) ) throw new Error ( `User ${ actor } does not have write permissions` )
734717}
735718
736719async function updateComment ( body : string ) {
@@ -774,9 +757,7 @@ function footer(opts?: { image?: boolean }) {
774757
775758 return `<a href="${ useShareUrl ( ) } /s/${ shareId } "><img width="200" alt="${ titleAlt } " src="https://social-cards.sst.dev/opencode-share/${ title64 } .png?model=${ providerID } /${ modelID } &version=${ session . version } &id=${ shareId } " /></a>\n`
776759 } ) ( )
777- const shareUrl = shareId
778- ? `[opencode session](${ useShareUrl ( ) } /s/${ shareId } ) | `
779- : ""
760+ const shareUrl = shareId ? `[opencode session](${ useShareUrl ( ) } /s/${ shareId } ) | ` : ""
780761 return `\n\n${ image } ${ shareUrl } [github run](${ useEnvRunUrl ( ) } )`
781762}
782763
@@ -959,13 +940,9 @@ function buildPromptDataForPR(pr: GitHubPullRequest) {
959940 } )
960941 . map ( ( c ) => `- ${ c . author . login } at ${ c . createdAt } : ${ c . body } ` )
961942
962- const files = ( pr . files . nodes || [ ] ) . map (
963- ( f ) => `- ${ f . path } (${ f . changeType } ) +${ f . additions } /-${ f . deletions } ` ,
964- )
943+ const files = ( pr . files . nodes || [ ] ) . map ( ( f ) => `- ${ f . path } (${ f . changeType } ) +${ f . additions } /-${ f . deletions } ` )
965944 const reviewData = ( pr . reviews . nodes || [ ] ) . map ( ( r ) => {
966- const comments = ( r . comments . nodes || [ ] ) . map (
967- ( c ) => ` - ${ c . path } :${ c . line ?? "?" } : ${ c . body } ` ,
968- )
945+ const comments = ( r . comments . nodes || [ ] ) . map ( ( c ) => ` - ${ c . path } :${ c . line ?? "?" } : ${ c . body } ` )
969946 return [
970947 `- ${ r . author . login } at ${ r . submittedAt } :` ,
971948 ` - Review body: ${ r . body } ` ,
@@ -987,15 +964,9 @@ function buildPromptDataForPR(pr: GitHubPullRequest) {
987964 `Deletions: ${ pr . deletions } ` ,
988965 `Total Commits: ${ pr . commits . totalCount } ` ,
989966 `Changed Files: ${ pr . files . nodes . length } files` ,
990- ...( comments . length > 0
991- ? [ "<pull_request_comments>" , ...comments , "</pull_request_comments>" ]
992- : [ ] ) ,
993- ...( files . length > 0
994- ? [ "<pull_request_changed_files>" , ...files , "</pull_request_changed_files>" ]
995- : [ ] ) ,
996- ...( reviewData . length > 0
997- ? [ "<pull_request_reviews>" , ...reviewData , "</pull_request_reviews>" ]
998- : [ ] ) ,
967+ ...( comments . length > 0 ? [ "<pull_request_comments>" , ...comments , "</pull_request_comments>" ] : [ ] ) ,
968+ ...( files . length > 0 ? [ "<pull_request_changed_files>" , ...files , "</pull_request_changed_files>" ] : [ ] ) ,
969+ ...( reviewData . length > 0 ? [ "<pull_request_reviews>" , ...reviewData , "</pull_request_reviews>" ] : [ ] ) ,
999970 "</pull_request>" ,
1000971 ] . join ( "\n" )
1001972}
0 commit comments