Skip to content

Commit d178d82

Browse files
chore: generate
1 parent e6f5214 commit d178d82

7 files changed

Lines changed: 118 additions & 44 deletions

File tree

packages/app/e2e/projects/projects-switch.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
import { base64Decode } from "@opencode-ai/util/encode"
22
import type { Page } from "@playwright/test"
33
import { test, expect } from "../fixtures"
4-
import { defocus, createTestProject, cleanupTestProject, openSidebar, sessionIDFromUrl, waitDir, waitSlug } from "../actions"
4+
import {
5+
defocus,
6+
createTestProject,
7+
cleanupTestProject,
8+
openSidebar,
9+
sessionIDFromUrl,
10+
waitDir,
11+
waitSlug,
12+
} from "../actions"
513
import { projectSwitchSelector, promptSelector, workspaceItemSelector, workspaceNewSessionSelector } from "../selectors"
614
import { dirSlug, resolveDirectory } from "../utils"
715

packages/app/src/pages/layout.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,8 @@ export default function Layout(props: ParentProps) {
633633
if (!expanded) continue
634634
const key = workspaceKey(directory)
635635
const project = projects.find(
636-
(item) => workspaceKey(item.worktree) === key || item.sandboxes?.some((sandbox) => workspaceKey(sandbox) === key),
636+
(item) =>
637+
workspaceKey(item.worktree) === key || item.sandboxes?.some((sandbox) => workspaceKey(sandbox) === key),
637638
)
638639
if (!project) continue
639640
if (project.vcs === "git" && layout.sidebar.workspaces(project.worktree)()) continue
@@ -1163,7 +1164,8 @@ export default function Layout(props: ParentProps) {
11631164
const project = layout.projects
11641165
.list()
11651166
.find(
1166-
(item) => workspaceKey(item.worktree) === key || item.sandboxes?.some((sandbox) => workspaceKey(sandbox) === key),
1167+
(item) =>
1168+
workspaceKey(item.worktree) === key || item.sandboxes?.some((sandbox) => workspaceKey(sandbox) === key),
11671169
)
11681170
if (project) return project.worktree
11691171

packages/app/src/pages/layout/helpers.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ function sortSessions(now: number) {
3131
const isRootVisibleSession = (session: Session, directory: string) =>
3232
workspaceKey(session.directory) === workspaceKey(directory) && !session.parentID && !session.time?.archived
3333

34-
const roots = (store: SessionStore) => (store.session ?? []).filter((session) => isRootVisibleSession(session, store.path.directory))
34+
const roots = (store: SessionStore) =>
35+
(store.session ?? []).filter((session) => isRootVisibleSession(session, store.path.directory))
3536

3637
export const sortedRootSessions = (store: SessionStore, now: number) => roots(store).sort(sortSessions(now))
3738

38-
export const latestRootSession = (stores: SessionStore[], now: number) => stores.flatMap(roots).sort(sortSessions(now))[0]
39+
export const latestRootSession = (stores: SessionStore[], now: number) =>
40+
stores.flatMap(roots).sort(sortSessions(now))[0]
3941

4042
export function hasProjectPermissions<T>(
4143
request: Record<string, T[] | undefined>,

packages/app/src/pages/session.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,12 @@ export default function Page() {
599599
const list: ChangeMode[] = []
600600
const git = sync.project?.vcs === "git"
601601
if (git) list.push("git")
602-
if (git && sync.data.vcs?.branch && sync.data.vcs?.default_branch && sync.data.vcs.branch !== sync.data.vcs.default_branch) {
602+
if (
603+
git &&
604+
sync.data.vcs?.branch &&
605+
sync.data.vcs?.default_branch &&
606+
sync.data.vcs.branch !== sync.data.vcs.default_branch
607+
) {
603608
list.push("branch")
604609
}
605610
list.push("session", "turn")
@@ -961,7 +966,9 @@ export default function Page() {
961966

962967
const mobileChanges = createMemo(() => !isDesktop() && store.mobileTab === "changes")
963968
const wantsReview = createMemo(() =>
964-
isDesktop() ? desktopFileTreeOpen() || (desktopReviewOpen() && activeTab() === "review") : store.mobileTab === "changes",
969+
isDesktop()
970+
? desktopFileTreeOpen() || (desktopReviewOpen() && activeTab() === "review")
971+
: store.mobileTab === "changes",
965972
)
966973

967974
createEffect(() => {

packages/app/src/pages/session/session-side-panel.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,9 @@ export function SessionSidePanel(props: {
366366
<Tabs.List>
367367
<Tabs.Trigger value="changes" class="flex-1" classes={{ button: "w-full" }}>
368368
{props.reviewCount()}{" "}
369-
{language.t(props.reviewCount() === 1 ? "session.review.change.one" : "session.review.change.other")}
369+
{language.t(
370+
props.reviewCount() === 1 ? "session.review.change.one" : "session.review.change.other",
371+
)}
370372
</Tabs.Trigger>
371373
<Tabs.Trigger value="all" class="flex-1" classes={{ button: "w-full" }}>
372374
{language.t("session.files.all")}
@@ -395,9 +397,7 @@ export function SessionSidePanel(props: {
395397
/>
396398
</Show>
397399
</Match>
398-
<Match when={true}>
399-
{empty(props.empty())}
400-
</Match>
400+
<Match when={true}>{empty(props.empty())}</Match>
401401
</Switch>
402402
</Tabs.Content>
403403
<Tabs.Content value="all" class="bg-background-stronger px-3 py-0">

packages/opencode/test/project/project.test.ts

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,37 @@ mock.module("../../src/git", () => ({
2020
Git: {
2121
...gitModule.Git,
2222
run: (args: string[], opts: { cwd: string; env?: Record<string, string> }) => {
23-
const cmd = ["git", ...args].join(" ")
24-
if (
25-
mode === "rev-list-fail" &&
26-
cmd.includes("git rev-list") &&
27-
cmd.includes("--max-parents=0") &&
28-
cmd.includes("HEAD")
29-
) {
30-
return Promise.resolve({
31-
exitCode: 128,
32-
text: () => "",
33-
stdout: Buffer.from(""),
34-
stderr: Buffer.from("fatal"),
35-
})
36-
}
37-
if (mode === "top-fail" && cmd.includes("git rev-parse") && cmd.includes("--show-toplevel")) {
38-
return Promise.resolve({
39-
exitCode: 128,
40-
text: () => "",
41-
stdout: Buffer.from(""),
42-
stderr: Buffer.from("fatal"),
43-
})
44-
}
45-
if (mode === "common-dir-fail" && cmd.includes("git rev-parse") && cmd.includes("--git-common-dir")) {
46-
return Promise.resolve({
47-
exitCode: 128,
48-
text: () => "",
49-
stdout: Buffer.from(""),
50-
stderr: Buffer.from("fatal"),
51-
})
52-
}
53-
return originalGit(args, opts)
23+
const cmd = ["git", ...args].join(" ")
24+
if (
25+
mode === "rev-list-fail" &&
26+
cmd.includes("git rev-list") &&
27+
cmd.includes("--max-parents=0") &&
28+
cmd.includes("HEAD")
29+
) {
30+
return Promise.resolve({
31+
exitCode: 128,
32+
text: () => "",
33+
stdout: Buffer.from(""),
34+
stderr: Buffer.from("fatal"),
35+
})
36+
}
37+
if (mode === "top-fail" && cmd.includes("git rev-parse") && cmd.includes("--show-toplevel")) {
38+
return Promise.resolve({
39+
exitCode: 128,
40+
text: () => "",
41+
stdout: Buffer.from(""),
42+
stderr: Buffer.from("fatal"),
43+
})
44+
}
45+
if (mode === "common-dir-fail" && cmd.includes("git rev-parse") && cmd.includes("--git-common-dir")) {
46+
return Promise.resolve({
47+
exitCode: 128,
48+
text: () => "",
49+
stdout: Buffer.from(""),
50+
stderr: Buffer.from("fatal"),
51+
})
52+
}
53+
return originalGit(args, opts)
5454
},
5555
},
5656
}))

packages/sdk/openapi.json

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6576,6 +6576,59 @@
65766576
]
65776577
}
65786578
},
6579+
"/vcs/diff": {
6580+
"get": {
6581+
"operationId": "vcs.diff",
6582+
"parameters": [
6583+
{
6584+
"in": "query",
6585+
"name": "directory",
6586+
"schema": {
6587+
"type": "string"
6588+
}
6589+
},
6590+
{
6591+
"in": "query",
6592+
"name": "workspace",
6593+
"schema": {
6594+
"type": "string"
6595+
}
6596+
},
6597+
{
6598+
"in": "query",
6599+
"name": "mode",
6600+
"schema": {
6601+
"type": "string",
6602+
"enum": ["git", "branch"]
6603+
},
6604+
"required": true
6605+
}
6606+
],
6607+
"summary": "Get VCS diff",
6608+
"description": "Retrieve the current git diff for the working tree or against the default branch.",
6609+
"responses": {
6610+
"200": {
6611+
"description": "VCS diff",
6612+
"content": {
6613+
"application/json": {
6614+
"schema": {
6615+
"type": "array",
6616+
"items": {
6617+
"$ref": "#/components/schemas/FileDiff"
6618+
}
6619+
}
6620+
}
6621+
}
6622+
}
6623+
},
6624+
"x-codeSamples": [
6625+
{
6626+
"lang": "js",
6627+
"source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.vcs.diff({\n ...\n})"
6628+
}
6629+
]
6630+
}
6631+
},
65796632
"/command": {
65806633
"get": {
65816634
"operationId": "command.list",
@@ -11928,9 +11981,11 @@
1192811981
"properties": {
1192911982
"branch": {
1193011983
"type": "string"
11984+
},
11985+
"default_branch": {
11986+
"type": "string"
1193111987
}
11932-
},
11933-
"required": ["branch"]
11988+
}
1193411989
},
1193511990
"Command": {
1193611991
"type": "object",

0 commit comments

Comments
 (0)