The open source coding agent.
TypeScript
chore: generate
opencode-agent[bot]d178d8249ffb
diff --git a/packages/app/e2e/projects/projects-switch.spec.ts b/packages/app/e2e/projects/projects-switch.spec.tsindex 1416aec7267..e9cbf868dff 100644--- a/packages/app/e2e/projects/projects-switch.spec.ts+++ b/packages/app/e2e/projects/projects-switch.spec.ts@@ -1,7 +1,15 @@import { base64Decode } from "@opencode-ai/util/encode"import type { Page } from "@playwright/test"import { test, expect } from "../fixtures"-import { defocus, createTestProject, cleanupTestProject, openSidebar, sessionIDFromUrl, waitDir, waitSlug } from "../actions"+import {+ defocus,+ createTestProject,+ cleanupTestProject,+ openSidebar,+ sessionIDFromUrl,+ waitDir,+ waitSlug,+} from "../actions"import { projectSwitchSelector, promptSelector, workspaceItemSelector, workspaceNewSessionSelector } from "../selectors"import { dirSlug, resolveDirectory } from "../utils"diff --git a/packages/app/src/pages/layout.tsx b/packages/app/src/pages/layout.tsxindex cca14fd50c9..52ac7c5f376 100644--- a/packages/app/src/pages/layout.tsx+++ b/packages/app/src/pages/layout.tsx@@ -633,7 +633,8 @@ export default function Layout(props: ParentProps) {if (!expanded) continueconst key = workspaceKey(directory)const project = projects.find(- (item) => workspaceKey(item.worktree) === key || item.sandboxes?.some((sandbox) => workspaceKey(sandbox) === key),+ (item) =>+ workspaceKey(item.worktree) === key || item.sandboxes?.some((sandbox) => workspaceKey(sandbox) === key),)if (!project) continueif (project.vcs === "git" && layout.sidebar.workspaces(project.worktree)()) continue@@ -1163,7 +1164,8 @@ export default function Layout(props: ParentProps) {const project = layout.projects.list().find(- (item) => workspaceKey(item.worktree) === key || item.sandboxes?.some((sandbox) => workspaceKey(sandbox) === key),+ (item) =>+ workspaceKey(item.worktree) === key || item.sandboxes?.some((sandbox) => workspaceKey(sandbox) === key),)if (project) return project.worktreediff --git a/packages/app/src/pages/layout/helpers.ts b/packages/app/src/pages/layout/helpers.tsindex 886ffd26a1a..209cff8a7ce 100644--- a/packages/app/src/pages/layout/helpers.ts+++ b/packages/app/src/pages/layout/helpers.ts@@ -31,11 +31,13 @@ function sortSessions(now: number) {const isRootVisibleSession = (session: Session, directory: string) =>workspaceKey(session.directory) === workspaceKey(directory) && !session.parentID && !session.time?.archived-const roots = (store: SessionStore) => (store.session ?? []).filter((session) => isRootVisibleSession(session, store.path.directory))+const roots = (store: SessionStore) =>+ (store.session ?? []).filter((session) => isRootVisibleSession(session, store.path.directory))export const sortedRootSessions = (store: SessionStore, now: number) => roots(store).sort(sortSessions(now))-export const latestRootSession = (stores: SessionStore[], now: number) => stores.flatMap(roots).sort(sortSessions(now))[0]+export const latestRootSession = (stores: SessionStore[], now: number) =>+ stores.flatMap(roots).sort(sortSessions(now))[0]export function hasProjectPermissions<T>(request: Record<string, T[] | undefined>,diff --git a/packages/app/src/pages/session.tsx b/packages/app/src/pages/session.tsxindex 6fe2e56b8e0..11d1481c0e2 100644--- a/packages/app/src/pages/session.tsx+++ b/packages/app/src/pages/session.tsx@@ -599,7 +599,12 @@ export default function Page() {const list: ChangeMode[] = []const git = sync.project?.vcs === "git"if (git) list.push("git")- if (git && sync.data.vcs?.branch && sync.data.vcs?.default_branch && sync.data.vcs.branch !== sync.data.vcs.default_branch) {+ if (+ git &&+ sync.data.vcs?.branch &&+ sync.data.vcs?.default_branch &&+ sync.data.vcs.branch !== sync.data.vcs.default_branch+ ) {list.push("branch")}list.push("session", "turn")@@ -961,7 +966,9 @@ export default function Page() {const mobileChanges = createMemo(() => !isDesktop() && store.mobileTab === "changes")const wantsReview = createMemo(() =>- isDesktop() ? desktopFileTreeOpen() || (desktopReviewOpen() && activeTab() === "review") : store.mobileTab === "changes",+ isDesktop()+ ? desktopFileTreeOpen() || (desktopReviewOpen() && activeTab() === "review")+ : store.mobileTab === "changes",)createEffect(() => {diff --git a/packages/app/src/pages/session/session-side-panel.tsx b/packages/app/src/pages/session/session-side-panel.tsxindex ed90c97dc87..3ba619736bd 100644--- a/packages/app/src/pages/session/session-side-panel.tsx+++ b/packages/app/src/pages/session/session-side-panel.tsx@@ -366,7 +366,9 @@ export function SessionSidePanel(props: {<Tabs.List><Tabs.Trigger value="changes" class="flex-1" classes={{ button: "w-full" }}>{props.reviewCount()}{" "}- {language.t(props.reviewCount() === 1 ? "session.review.change.one" : "session.review.change.other")}+ {language.t(+ props.reviewCount() === 1 ? "session.review.change.one" : "session.review.change.other",+ )}</Tabs.Trigger><Tabs.Trigger value="all" class="flex-1" classes={{ button: "w-full" }}>{language.t("session.files.all")}@@ -395,9 +397,7 @@ export function SessionSidePanel(props: {/></Show></Match>- <Match when={true}>- {empty(props.empty())}- </Match>+ <Match when={true}>{empty(props.empty())}</Match></Switch></Tabs.Content><Tabs.Content value="all" class="bg-background-stronger px-3 py-0">diff --git a/packages/opencode/test/project/project.test.ts b/packages/opencode/test/project/project.test.tsindex 43c86c32eee..e6588fb38e1 100644--- a/packages/opencode/test/project/project.test.ts+++ b/packages/opencode/test/project/project.test.ts@@ -20,37 +20,37 @@ mock.module("../../src/git", () => ({Git: {...gitModule.Git,run: (args: string[], opts: { cwd: string; env?: Record<string, string> }) => {- const cmd = ["git", ...args].join(" ")- if (- mode === "rev-list-fail" &&- cmd.includes("git rev-list") &&- cmd.includes("--max-parents=0") &&- cmd.includes("HEAD")- ) {- return Promise.resolve({- exitCode: 128,- text: () => "",- stdout: Buffer.from(""),- stderr: Buffer.from("fatal"),- })- }- if (mode === "top-fail" && cmd.includes("git rev-parse") && cmd.includes("--show-toplevel")) {- return Promise.resolve({- exitCode: 128,- text: () => "",- stdout: Buffer.from(""),- stderr: Buffer.from("fatal"),- })- }- if (mode === "common-dir-fail" && cmd.includes("git rev-parse") && cmd.includes("--git-common-dir")) {- return Promise.resolve({- exitCode: 128,- text: () => "",- stdout: Buffer.from(""),- stderr: Buffer.from("fatal"),- })- }- return originalGit(args, opts)+ const cmd = ["git", ...args].join(" ")+ if (+ mode === "rev-list-fail" &&+ cmd.includes("git rev-list") &&+ cmd.includes("--max-parents=0") &&+ cmd.includes("HEAD")+ ) {+ return Promise.resolve({+ exitCode: 128,+ text: () => "",+ stdout: Buffer.from(""),+ stderr: Buffer.from("fatal"),+ })+ }+ if (mode === "top-fail" && cmd.includes("git rev-parse") && cmd.includes("--show-toplevel")) {+ return Promise.resolve({+ exitCode: 128,+ text: () => "",+ stdout: Buffer.from(""),+ stderr: Buffer.from("fatal"),+ })+ }+ if (mode === "common-dir-fail" && cmd.includes("git rev-parse") && cmd.includes("--git-common-dir")) {+ return Promise.resolve({+ exitCode: 128,+ text: () => "",+ stdout: Buffer.from(""),+ stderr: Buffer.from("fatal"),+ })+ }+ return originalGit(args, opts)},},}))diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.jsonindex 350395423f0..41819ef1207 100644--- a/packages/sdk/openapi.json+++ b/packages/sdk/openapi.json@@ -6576,6 +6576,59 @@]}},+ "/vcs/diff": {+ "get": {+ "operationId": "vcs.diff",+ "parameters": [+ {+ "in": "query",+ "name": "directory",+ "schema": {+ "type": "string"+ }+ },+ {+ "in": "query",+ "name": "workspace",+ "schema": {+ "type": "string"+ }+ },+ {+ "in": "query",+ "name": "mode",+ "schema": {+ "type": "string",+ "enum": ["git", "branch"]+ },+ "required": true+ }+ ],+ "summary": "Get VCS diff",+ "description": "Retrieve the current git diff for the working tree or against the default branch.",+ "responses": {+ "200": {+ "description": "VCS diff",+ "content": {+ "application/json": {+ "schema": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/FileDiff"+ }+ }+ }+ }+ }+ },+ "x-codeSamples": [+ {+ "lang": "js",+ "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.vcs.diff({\n ...\n})"+ }+ ]+ }+ },"/command": {"get": {"operationId": "command.list",@@ -11928,9 +11981,11 @@"properties": {"branch": {"type": "string"+ },+ "default_branch": {+ "type": "string"}- },- "required": ["branch"]+ }},"Command": {"type": "object",