Skip to content

Commit 79bbf90

Browse files
committed
chore: rework openapi spec and use stainless sdk
1 parent 226a4a7 commit 79bbf90

28 files changed

Lines changed: 575 additions & 6551 deletions

File tree

README.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,7 @@ $ bun run packages/opencode/src/index.ts
5454

5555
#### Development Notes
5656

57-
**API Client Generation**: After making changes to the TypeScript API endpoints in `packages/opencode/src/server/server.ts`, you need to regenerate the Go client and OpenAPI specification:
58-
59-
```bash
60-
$ cd packages/tui
61-
$ go generate ./pkg/client/
62-
```
63-
64-
This updates the generated Go client code that the TUI uses to communicate with the backend server.
57+
**API Client**: After making changes to the TypeScript API endpoints in `packages/opencode/src/server/server.ts`, you will need the opencode team to generate a new stainless sdk for the clients.
6558

6659
### FAQ
6760

packages/opencode/AGENTS.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
- **Typecheck**: `bun run typecheck` (npm run typecheck)
88
- **Test**: `bun test` (runs all tests)
99
- **Single test**: `bun test test/tool/tool.test.ts` (specific test file)
10-
- **API Client Generation**: `cd packages/tui && go generate ./pkg/client/` (after changes to server endpoints)
1110

1211
## Code Style
1312

@@ -38,4 +37,4 @@
3837
- **Validation**: All inputs validated with Zod schemas
3938
- **Logging**: Use `Log.create({ service: "name" })` pattern
4039
- **Storage**: Use `Storage` namespace for persistence
41-
- **API Client**: Go TUI communicates with TypeScript server via generated client. When adding/modifying server endpoints in `packages/opencode/src/server/server.ts`, run `cd packages/tui && go generate ./pkg/client/` to update the Go client code and OpenAPI spec.
40+
- **API Client**: Go TUI communicates with TypeScript server via stainless SDK. When adding/modifying server endpoints in `packages/opencode/src/server/server.ts`, ask the user to generate a new client SDK to proceed with client-side changes.

packages/opencode/src/app/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export namespace App {
2727
}),
2828
})
2929
.openapi({
30-
ref: "App.Info",
30+
ref: "App",
3131
})
3232
export type Info = z.infer<typeof Info>
3333

packages/opencode/src/config/config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export namespace Config {
4040
})
4141
.strict()
4242
.openapi({
43-
ref: "Config.McpLocal",
43+
ref: "McpLocalConfig",
4444
})
4545

4646
export const McpRemote = z
@@ -50,7 +50,7 @@ export namespace Config {
5050
})
5151
.strict()
5252
.openapi({
53-
ref: "Config.McpRemote",
53+
ref: "McpRemoteConfig",
5454
})
5555

5656
export const Mcp = z.discriminatedUnion("type", [McpLocal, McpRemote])
@@ -124,7 +124,7 @@ export namespace Config {
124124
})
125125
.strict()
126126
.openapi({
127-
ref: "Config.Keybinds",
127+
ref: "KeybindsConfig",
128128
})
129129
export const Info = z
130130
.object({
@@ -197,7 +197,7 @@ export namespace Config {
197197
})
198198
.strict()
199199
.openapi({
200-
ref: "Config.Info",
200+
ref: "Config",
201201
})
202202

203203
export type Info = z.output<typeof Info>

packages/opencode/src/provider/models.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export namespace ModelsDev {
2929
options: z.record(z.any()),
3030
})
3131
.openapi({
32-
ref: "Model.Info",
32+
ref: "Model",
3333
})
3434
export type Model = z.infer<typeof Model>
3535

@@ -43,7 +43,7 @@ export namespace ModelsDev {
4343
models: z.record(Model),
4444
})
4545
.openapi({
46-
ref: "Provider.Info",
46+
ref: "Provider",
4747
})
4848

4949
export type Provider = z.infer<typeof Provider>

0 commit comments

Comments
 (0)