Skip to content

Commit 34ff87d

Browse files
committed
chore: format code
1 parent 16357e8 commit 34ff87d

File tree

182 files changed

+941
-3647
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+941
-3647
lines changed

github/index.ts

Lines changed: 14 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -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. ![Image](https://github.com/user-attachments/assets/xxxx)
414-
const mdMatches = prompt.matchAll(
415-
/!?\[.*?\]\((https:\/\/github\.com\/user-attachments\/[^)]+)\)/gi,
416-
)
417-
const tagMatches = prompt.matchAll(
418-
/<img .*?src="(https:\/\/github\.com\/user-attachments\/[^"]+)" \/>/gi,
419-
)
408+
const mdMatches = prompt.matchAll(/!?\[.*?\]\((https:\/\/github\.com\/user-attachments\/[^)]+)\)/gi)
409+
const tagMatches = prompt.matchAll(/<img .*?src="(https:\/\/github\.com\/user-attachments\/[^"]+)" \/>/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

736719
async 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})&nbsp;&nbsp;|&nbsp;&nbsp;`
779-
: ""
760+
const shareUrl = shareId ? `[opencode session](${useShareUrl()}/s/${shareId})&nbsp;&nbsp;|&nbsp;&nbsp;` : ""
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
}

infra/console.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,7 @@ export const auth = new sst.cloudflare.Worker("AuthApi", {
6161
domain: `auth.${domain}`,
6262
handler: "packages/console/function/src/auth.ts",
6363
url: true,
64-
link: [
65-
database,
66-
authStorage,
67-
GITHUB_CLIENT_ID_CONSOLE,
68-
GITHUB_CLIENT_SECRET_CONSOLE,
69-
GOOGLE_CLIENT_ID,
70-
],
64+
link: [database, authStorage, GITHUB_CLIENT_ID_CONSOLE, GITHUB_CLIENT_SECRET_CONSOLE, GOOGLE_CLIENT_ID],
7165
})
7266

7367
////////////////

packages/console/app/src/app.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ export default function App() {
1212
root={(props) => (
1313
<MetaProvider>
1414
<Title>opencode</Title>
15-
<Meta
16-
name="description"
17-
content="OpenCode - The AI coding agent built for the terminal."
18-
/>
15+
<Meta name="description" content="OpenCode - The AI coding agent built for the terminal." />
1916
<Suspense>{props.children}</Suspense>
2017
</MetaProvider>
2118
)}

packages/console/app/src/component/faq.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ export function Faq(props: ParentProps & { question: string }) {
1313
fill="currentColor"
1414
xmlns="http://www.w3.org/2000/svg"
1515
>
16-
<path
17-
d="M12.5 11.5H19V12.5H12.5V19H11.5V12.5H5V11.5H11.5V5H12.5V11.5Z"
18-
fill="currentColor"
19-
/>
16+
<path d="M12.5 11.5H19V12.5H12.5V19H11.5V12.5H5V11.5H11.5V5H12.5V11.5Z" fill="currentColor" />
2017
</svg>
2118
<svg
2219
data-slot="faq-icon-minus"

packages/console/app/src/component/icon.tsx

Lines changed: 20 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,10 @@ export function IconLogo(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
99
<path d="M13.7124 9.14333V4.5719H18.2838V9.14333H13.7124Z" fill="currentColor" />
1010
<path d="M13.7124 13.7136V9.14221H18.2838V13.7136H13.7124Z" fill="currentColor" />
1111
<path d="M0 18.2857V13.7142H4.57143V18.2857H0Z" fill="currentColor" fill-opacity="0.2" />
12-
<rect
13-
width="4.57143"
14-
height="4.57143"
15-
transform="translate(4.57178 13.7141)"
16-
fill="currentColor"
17-
/>
18-
<path
19-
d="M4.57178 18.2855V13.7141H9.14321V18.2855H4.57178Z"
20-
fill="currentColor"
21-
fill-opacity="0.2"
22-
/>
12+
<rect width="4.57143" height="4.57143" transform="translate(4.57178 13.7141)" fill="currentColor" />
13+
<path d="M4.57178 18.2855V13.7141H9.14321V18.2855H4.57178Z" fill="currentColor" fill-opacity="0.2" />
2314
<path d="M9.1438 18.2855V13.7141H13.7152V18.2855H9.1438Z" fill="currentColor" />
24-
<path
25-
d="M13.7156 18.2855V13.7141H18.287V18.2855H13.7156Z"
26-
fill="currentColor"
27-
fill-opacity="0.2"
28-
/>
15+
<path d="M13.7156 18.2855V13.7141H18.287V18.2855H13.7156Z" fill="currentColor" fill-opacity="0.2" />
2916
<rect width="4.57143" height="4.57143" transform="translate(0 18.2859)" fill="currentColor" />
3017
<path d="M0 22.8572V18.2858H4.57143V22.8572H0Z" fill="currentColor" fill-opacity="0.2" />
3118
<rect
@@ -36,16 +23,8 @@ export function IconLogo(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
3623
fill-opacity="0.2"
3724
/>
3825
<path d="M4.57178 22.8573V18.2859H9.14321V22.8573H4.57178Z" fill="currentColor" />
39-
<path
40-
d="M9.1438 22.8573V18.2859H13.7152V22.8573H9.1438Z"
41-
fill="currentColor"
42-
fill-opacity="0.2"
43-
/>
44-
<path
45-
d="M13.7156 22.8573V18.2859H18.287V22.8573H13.7156Z"
46-
fill="currentColor"
47-
fill-opacity="0.2"
48-
/>
26+
<path d="M9.1438 22.8573V18.2859H13.7152V22.8573H9.1438Z" fill="currentColor" fill-opacity="0.2" />
27+
<path d="M13.7156 22.8573V18.2859H18.287V22.8573H13.7156Z" fill="currentColor" fill-opacity="0.2" />
4928
<path d="M0 27.4292V22.8578H4.57143V27.4292H0Z" fill="currentColor" />
5029
<path d="M4.57178 27.4292V22.8578H9.14321V27.4292H4.57178Z" fill="currentColor" />
5130
<path d="M9.1438 27.4276V22.8562H13.7152V27.4276H9.1438Z" fill="currentColor" />
@@ -61,21 +40,9 @@ export function IconLogo(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
6140
<path d="M32.001 18.2855V13.7141H36.5724V18.2855H32.001Z" fill="currentColor" />
6241
<path d="M36.5698 18.2855V13.7141H41.1413V18.2855H36.5698Z" fill="currentColor" />
6342
<path d="M22.8572 22.8573V18.2859H27.4286V22.8573H22.8572Z" fill="currentColor" />
64-
<path
65-
d="M27.4292 22.8573V18.2859H32.0006V22.8573H27.4292Z"
66-
fill="currentColor"
67-
fill-opacity="0.2"
68-
/>
69-
<path
70-
d="M32.001 22.8573V18.2859H36.5724V22.8573H32.001Z"
71-
fill="currentColor"
72-
fill-opacity="0.2"
73-
/>
74-
<path
75-
d="M36.5698 22.8573V18.2859H41.1413V22.8573H36.5698Z"
76-
fill="currentColor"
77-
fill-opacity="0.2"
78-
/>
43+
<path d="M27.4292 22.8573V18.2859H32.0006V22.8573H27.4292Z" fill="currentColor" fill-opacity="0.2" />
44+
<path d="M32.001 22.8573V18.2859H36.5724V22.8573H32.001Z" fill="currentColor" fill-opacity="0.2" />
45+
<path d="M36.5698 22.8573V18.2859H41.1413V22.8573H36.5698Z" fill="currentColor" fill-opacity="0.2" />
7946
<path d="M22.8572 27.4292V22.8578H27.4286V27.4292H22.8572Z" fill="currentColor" />
8047
<path d="M27.4292 27.4276V22.8562H32.0006V27.4276H27.4292Z" fill="currentColor" />
8148
<path d="M32.001 27.4276V22.8562H36.5724V27.4276H32.001Z" fill="currentColor" />
@@ -86,55 +53,24 @@ export function IconLogo(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
8653
<path d="M45.7144 13.7136V9.14221H50.2858V13.7136H45.7144Z" fill="currentColor" />
8754
<path d="M59.4299 13.7152V9.1438H64.0014V13.7152H59.4299Z" fill="currentColor" />
8855
<path d="M45.7144 18.2855V13.7141H50.2858V18.2855H45.7144Z" fill="currentColor" />
89-
<path
90-
d="M50.2861 18.2857V13.7142H54.8576V18.2857H50.2861Z"
91-
fill="currentColor"
92-
fill-opacity="0.2"
93-
/>
94-
<path
95-
d="M54.8579 18.2855V13.7141H59.4293V18.2855H54.8579Z"
96-
fill="currentColor"
97-
fill-opacity="0.2"
98-
/>
56+
<path d="M50.2861 18.2857V13.7142H54.8576V18.2857H50.2861Z" fill="currentColor" fill-opacity="0.2" />
57+
<path d="M54.8579 18.2855V13.7141H59.4293V18.2855H54.8579Z" fill="currentColor" fill-opacity="0.2" />
9958
<path d="M59.4299 18.2855V13.7141H64.0014V18.2855H59.4299Z" fill="currentColor" />
10059
<path d="M45.7144 22.8573V18.2859H50.2858V22.8573H45.7144Z" fill="currentColor" />
101-
<path
102-
d="M50.2861 22.8572V18.2858H54.8576V22.8572H50.2861Z"
103-
fill="currentColor"
104-
fill-opacity="0.2"
105-
/>
106-
<path
107-
d="M54.8579 22.8573V18.2859H59.4293V22.8573H54.8579Z"
108-
fill="currentColor"
109-
fill-opacity="0.2"
110-
/>
60+
<path d="M50.2861 22.8572V18.2858H54.8576V22.8572H50.2861Z" fill="currentColor" fill-opacity="0.2" />
61+
<path d="M54.8579 22.8573V18.2859H59.4293V22.8573H54.8579Z" fill="currentColor" fill-opacity="0.2" />
11162
<path d="M59.4299 22.8573V18.2859H64.0014V22.8573H59.4299Z" fill="currentColor" />
11263
<path d="M45.7144 27.4292V22.8578H50.2858V27.4292H45.7144Z" fill="currentColor" />
113-
<path
114-
d="M50.2861 27.4286V22.8572H54.8576V27.4286H50.2861Z"
115-
fill="currentColor"
116-
fill-opacity="0.2"
117-
/>
118-
<path
119-
d="M54.8579 27.4285V22.8571H59.4293V27.4285H54.8579Z"
120-
fill="currentColor"
121-
fill-opacity="0.2"
122-
/>
64+
<path d="M50.2861 27.4286V22.8572H54.8576V27.4286H50.2861Z" fill="currentColor" fill-opacity="0.2" />
65+
<path d="M54.8579 27.4285V22.8571H59.4293V27.4285H54.8579Z" fill="currentColor" fill-opacity="0.2" />
12366
<path d="M59.4299 27.4292V22.8578H64.0014V27.4292H59.4299Z" fill="currentColor" />
12467
</svg>
12568
)
12669
}
12770

12871
export function IconCopy(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
12972
return (
130-
<svg
131-
{...props}
132-
width="24"
133-
height="24"
134-
viewBox="0 0 24 24"
135-
fill="none"
136-
xmlns="http://www.w3.org/2000/svg"
137-
>
73+
<svg {...props} width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
13874
<path
13975
d="M8.75 8.75V2.75H21.25V15.25H15.25M15.25 8.75H2.75V21.25H15.25V8.75Z"
14076
stroke="currentColor"
@@ -147,20 +83,8 @@ export function IconCopy(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
14783

14884
export function IconCheck(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
14985
return (
150-
<svg
151-
{...props}
152-
width="24"
153-
height="24"
154-
viewBox="0 0 24 24"
155-
fill="none"
156-
xmlns="http://www.w3.org/2000/svg"
157-
>
158-
<path
159-
d="M2.75 15.0938L9 20.25L21.25 3.75"
160-
stroke="#03B000"
161-
stroke-width="2"
162-
stroke-linecap="square"
163-
/>
86+
<svg {...props} width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
87+
<path d="M2.75 15.0938L9 20.25L21.25 3.75" stroke="#03B000" stroke-width="2" stroke-linecap="square" />
16488
</svg>
16589
)
16690
}
@@ -189,14 +113,7 @@ export function IconStripe(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
189113

190114
export function IconChevron(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
191115
return (
192-
<svg
193-
{...props}
194-
width="8"
195-
height="6"
196-
viewBox="0 0 8 6"
197-
fill="none"
198-
xmlns="http://www.w3.org/2000/svg"
199-
>
116+
<svg {...props} width="8" height="6" viewBox="0 0 8 6" fill="none" xmlns="http://www.w3.org/2000/svg">
200117
<path
201118
fill="currentColor"
202119
d="M4.00024 5.04041L7.37401 1.66663L6.66691 0.959525L4.00024 3.62619L1.33357 0.959525L0.626465 1.66663L4.00024 5.04041Z"
@@ -207,14 +124,7 @@ export function IconChevron(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
207124

208125
export function IconWorkspaceLogo(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
209126
return (
210-
<svg
211-
{...props}
212-
width="24"
213-
height="30"
214-
viewBox="0 0 24 30"
215-
fill="none"
216-
xmlns="http://www.w3.org/2000/svg"
217-
>
127+
<svg {...props} width="24" height="30" viewBox="0 0 24 30" fill="none" xmlns="http://www.w3.org/2000/svg">
218128
<path d="M18 6H6V24H18V6ZM24 30H0V0H24V30Z" fill="currentColor" />
219129
</svg>
220130
)
@@ -234,10 +144,7 @@ export function IconOpenAI(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
234144
export function IconAnthropic(props: JSX.SvgSVGAttributes<SVGSVGElement>) {
235145
return (
236146
<svg {...props} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
237-
<path
238-
fill="currentColor"
239-
d="M13.7891 3.93188L20.2223 20.068H23.7502L17.317 3.93188H13.7891Z"
240-
/>
147+
<path fill="currentColor" d="M13.7891 3.93188L20.2223 20.068H23.7502L17.317 3.93188H13.7891Z" />
241148
<path
242149
fill="currentColor"
243150
d="M6.32538 13.6827L8.52662 8.01201L10.7279 13.6827H6.32538ZM6.68225 3.93188L0.25 20.068H3.84652L5.16202 16.6794H11.8914L13.2067 20.068H16.8033L10.371 3.93188H6.68225Z"

packages/console/app/src/lib/github.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ export const github = query(async () => {
77
"User-Agent":
88
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
99
}
10-
const apiBaseUrl = config.github.repoUrl.replace(
11-
"https://github.com/",
12-
"https://api.github.com/repos/",
13-
)
10+
const apiBaseUrl = config.github.repoUrl.replace("https://github.com/", "https://api.github.com/repos/")
1411
try {
1512
const [meta, releases, contributors] = await Promise.all([
1613
fetch(apiBaseUrl, { headers }).then((res) => res.json()),

packages/console/app/src/routes/auth/authorize.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import type { APIEvent } from "@solidjs/start/server"
22
import { AuthClient } from "~/context/auth"
33

44
export async function GET(input: APIEvent) {
5-
const result = await AuthClient.authorize(
6-
new URL("./callback", input.request.url).toString(),
7-
"code",
8-
)
5+
const result = await AuthClient.authorize(new URL("./callback", input.request.url).toString(), "code")
96
return Response.redirect(result.url, 302)
107
}

0 commit comments

Comments
 (0)