summaryrefslogtreecommitdiffhomepage
path: root/packages/sdk/js/src
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2025-11-25 19:39:20 -0800
committerGitHub <[email protected]>2025-11-25 21:39:20 -0600
commit09bc8d9ca496bc338396b5c3cb90bbb1d8b79f8a (patch)
treef3aa608b19422b6d3e29d0eafe18cec2463a781a /packages/sdk/js/src
parentd95f724303ac139db1a465c061af76bb6fbfda65 (diff)
downloadopencode-09bc8d9ca496bc338396b5c3cb90bbb1d8b79f8a.tar.gz
opencode-09bc8d9ca496bc338396b5c3cb90bbb1d8b79f8a.zip
show current git branch in tui (#4765)
Co-authored-by: GitHub Action <[email protected]>
Diffstat (limited to 'packages/sdk/js/src')
-rw-r--r--packages/sdk/js/src/gen/sdk.gen.ts15
-rw-r--r--packages/sdk/js/src/gen/types.gen.ts35
2 files changed, 50 insertions, 0 deletions
diff --git a/packages/sdk/js/src/gen/sdk.gen.ts b/packages/sdk/js/src/gen/sdk.gen.ts
index afc9696f1..0dc470566 100644
--- a/packages/sdk/js/src/gen/sdk.gen.ts
+++ b/packages/sdk/js/src/gen/sdk.gen.ts
@@ -23,6 +23,8 @@ import type {
InstanceDisposeResponses,
PathGetData,
PathGetResponses,
+ VcsGetData,
+ VcsGetResponses,
SessionListData,
SessionListResponses,
SessionCreateData,
@@ -311,6 +313,18 @@ class Path extends _HeyApiClient {
}
}
+class Vcs extends _HeyApiClient {
+ /**
+ * Get VCS info for the current instance
+ */
+ public get<ThrowOnError extends boolean = false>(options?: Options<VcsGetData, ThrowOnError>) {
+ return (options?.client ?? this._client).get<VcsGetResponses, unknown, ThrowOnError>({
+ url: "/vcs",
+ ...options,
+ })
+ }
+}
+
class Session extends _HeyApiClient {
/**
* List all sessions
@@ -995,6 +1009,7 @@ export class OpencodeClient extends _HeyApiClient {
tool = new Tool({ client: this._client })
instance = new Instance({ client: this._client })
path = new Path({ client: this._client })
+ vcs = new Vcs({ client: this._client })
session = new Session({ client: this._client })
command = new Command({ client: this._client })
provider = new Provider({ client: this._client })
diff --git a/packages/sdk/js/src/gen/types.gen.ts b/packages/sdk/js/src/gen/types.gen.ts
index 6e3b8c071..7e211148f 100644
--- a/packages/sdk/js/src/gen/types.gen.ts
+++ b/packages/sdk/js/src/gen/types.gen.ts
@@ -589,6 +589,13 @@ export type EventSessionError = {
}
}
+export type EventVcsChanged = {
+ type: "vcs.changed"
+ properties: {
+ branch?: string
+ }
+}
+
export type EventTuiPromptAppend = {
type: "tui.prompt.append"
properties: {
@@ -670,6 +677,7 @@ export type Event =
| EventSessionDeleted
| EventSessionDiff
| EventSessionError
+ | EventVcsChanged
| EventTuiPromptAppend
| EventTuiCommandExecute
| EventTuiToastShow
@@ -1251,6 +1259,15 @@ export type Path = {
directory: string
}
+export type VcsInfo = {
+ worktree: string
+ directory: string
+ projectID: string
+ vcs?: {
+ branch: string
+ }
+}
+
export type NotFoundError = {
name: "NotFoundError"
data: {
@@ -1687,6 +1704,24 @@ export type PathGetResponses = {
export type PathGetResponse = PathGetResponses[keyof PathGetResponses]
+export type VcsGetData = {
+ body?: never
+ path?: never
+ query?: {
+ directory?: string
+ }
+ url: "/vcs"
+}
+
+export type VcsGetResponses = {
+ /**
+ * VCS info
+ */
+ 200: VcsInfo
+}
+
+export type VcsGetResponse = VcsGetResponses[keyof VcsGetResponses]
+
export type SessionListData = {
body?: never
path?: never