Skip to content

Commit 33cef07

Browse files
authored
ci: new publish method (anomalyco#1451)
1 parent b09ebf4 commit 33cef07

190 files changed

Lines changed: 16141 additions & 13341 deletions

File tree

Some content is hidden

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

.github/workflows/publish.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@ name: publish
22

33
on:
44
workflow_dispatch:
5-
push:
6-
branches:
7-
- dev
8-
tags:
9-
- "*"
10-
- "!vscode-v*"
11-
- "!github-v*"
5+
inputs:
6+
version:
7+
description: "Version to publish"
8+
required: true
9+
type: string
1210

1311
concurrency: ${{ github.workflow }}-${{ github.ref }}
1412

@@ -53,11 +51,7 @@ jobs:
5351
- name: Publish
5452
run: |
5553
bun install
56-
if [ "${{ startsWith(github.ref, 'refs/tags/') }}" = "true" ]; then
57-
./script/publish.ts
58-
else
59-
./script/publish.ts --snapshot
60-
fi
54+
OPENCODE_VERSION=${{ inputs.version }} ./script/publish.ts
6155
working-directory: ./packages/opencode
6256
env:
6357
GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}

bun.lock

Lines changed: 84 additions & 899 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
},
1313
"workspaces": {
1414
"packages": [
15-
"packages/*"
15+
"packages/*",
16+
"packages/sdk/js"
1617
],
1718
"catalog": {
1819
"@types/node": "22.13.9",
20+
"@tsconfig/node22": "22.0.2",
1921
"ai": "5.0.0-beta.33",
2022
"hono": "4.7.10",
2123
"typescript": "5.8.2",

packages/opencode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json.schemastore.org/package.json",
3-
"version": "0.0.5",
3+
"version": "0.0.0",
44
"name": "opencode",
55
"type": "module",
66
"private": true,

packages/opencode/script/publish.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
#!/usr/bin/env bun
2-
2+
const dir = new URL("..", import.meta.url).pathname
3+
process.chdir(dir)
34
import { $ } from "bun"
45

56
import pkg from "../package.json"
67

7-
const dry = process.argv.includes("--dry")
8-
const snapshot = process.argv.includes("--snapshot")
9-
10-
const version = snapshot
11-
? `0.0.0-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}`
12-
: await $`git describe --tags --abbrev=0`
13-
.text()
14-
.then((x) => x.substring(1).trim())
15-
.catch(() => {
16-
console.error("tag not found")
17-
process.exit(1)
18-
})
8+
const dry = process.env["OPENCODE_DRY"] === "true"
9+
const version = process.env["OPENCODE_VERSION"]!
10+
const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true"
1911

2012
console.log(`publishing ${version}`)
2113

packages/opencode/src/format/formatter.ts

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { App } from "../app/app"
22
import { BunProc } from "../bun"
33
import { Filesystem } from "../util/filesystem"
4-
import path from "path"
54

65
export interface Info {
76
name: string
@@ -65,14 +64,57 @@ export const prettier: Info = {
6564
],
6665
async enabled() {
6766
const app = App.info()
68-
const nms = await Filesystem.findUp("node_modules", app.path.cwd, app.path.root)
69-
for (const item of nms) {
70-
if (await Bun.file(path.join(item, ".bin", "prettier")).exists()) return true
67+
const items = await Filesystem.findUp("package.json", app.path.cwd, app.path.root)
68+
for (const item of items) {
69+
const json = await Bun.file(item).json()
70+
if (json.dependencies?.prettier) return true
71+
if (json.devDependencies?.prettier) return true
7172
}
7273
return false
7374
},
7475
}
7576

77+
export const biome: Info = {
78+
name: "biome",
79+
command: [BunProc.which(), "x", "biome", "format", "--write", "$FILE"],
80+
environment: {
81+
BUN_BE_BUN: "1",
82+
},
83+
extensions: [
84+
".js",
85+
".jsx",
86+
".mjs",
87+
".cjs",
88+
".ts",
89+
".tsx",
90+
".mts",
91+
".cts",
92+
".html",
93+
".htm",
94+
".css",
95+
".scss",
96+
".sass",
97+
".less",
98+
".vue",
99+
".svelte",
100+
".json",
101+
".jsonc",
102+
".yaml",
103+
".yml",
104+
".toml",
105+
".xml",
106+
".md",
107+
".mdx",
108+
".graphql",
109+
".gql",
110+
],
111+
async enabled() {
112+
const app = App.info()
113+
const items = await Filesystem.findUp("biome.json", app.path.cwd, app.path.root)
114+
return items.length > 0
115+
},
116+
}
117+
76118
export const zig: Info = {
77119
name: "zig",
78120
command: ["zig", "fmt", "$FILE"],

packages/opencode/src/server/server.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export namespace Server {
9494
"/event",
9595
describeRoute({
9696
description: "Get events",
97+
operationId: "event.subscribe",
9798
responses: {
9899
200: {
99100
description: "Event stream",
@@ -137,6 +138,7 @@ export namespace Server {
137138
"/app",
138139
describeRoute({
139140
description: "Get app info",
141+
operationId: "app.get",
140142
responses: {
141143
200: {
142144
description: "200",
@@ -156,6 +158,7 @@ export namespace Server {
156158
"/app/init",
157159
describeRoute({
158160
description: "Initialize the app",
161+
operationId: "app.init",
159162
responses: {
160163
200: {
161164
description: "Initialize the app",
@@ -176,6 +179,7 @@ export namespace Server {
176179
"/config",
177180
describeRoute({
178181
description: "Get config info",
182+
operationId: "config.get",
179183
responses: {
180184
200: {
181185
description: "Get config info",
@@ -195,6 +199,7 @@ export namespace Server {
195199
"/session",
196200
describeRoute({
197201
description: "List all sessions",
202+
operationId: "session.list",
198203
responses: {
199204
200: {
200205
description: "List of sessions",
@@ -216,6 +221,7 @@ export namespace Server {
216221
"/session",
217222
describeRoute({
218223
description: "Create a new session",
224+
operationId: "session.create",
219225
responses: {
220226
...ERRORS,
221227
200: {
@@ -237,6 +243,7 @@ export namespace Server {
237243
"/session/:id",
238244
describeRoute({
239245
description: "Delete a session and all its data",
246+
operationId: "session.delete",
240247
responses: {
241248
200: {
242249
description: "Successfully deleted session",
@@ -263,6 +270,7 @@ export namespace Server {
263270
"/session/:id/init",
264271
describeRoute({
265272
description: "Analyze the app and create an AGENTS.md file",
273+
operationId: "session.init",
266274
responses: {
267275
200: {
268276
description: "200",
@@ -299,6 +307,7 @@ export namespace Server {
299307
"/session/:id/abort",
300308
describeRoute({
301309
description: "Abort a session",
310+
operationId: "session.abort",
302311
responses: {
303312
200: {
304313
description: "Aborted session",
@@ -324,6 +333,7 @@ export namespace Server {
324333
"/session/:id/share",
325334
describeRoute({
326335
description: "Share a session",
336+
operationId: "session.share",
327337
responses: {
328338
200: {
329339
description: "Successfully shared session",
@@ -352,6 +362,7 @@ export namespace Server {
352362
"/session/:id/share",
353363
describeRoute({
354364
description: "Unshare the session",
365+
operationId: "session.unshare",
355366
responses: {
356367
200: {
357368
description: "Successfully unshared session",
@@ -380,6 +391,7 @@ export namespace Server {
380391
"/session/:id/summarize",
381392
describeRoute({
382393
description: "Summarize the session",
394+
operationId: "session.summarize",
383395
responses: {
384396
200: {
385397
description: "Summarized session",
@@ -415,6 +427,7 @@ export namespace Server {
415427
"/session/:id/message",
416428
describeRoute({
417429
description: "List messages for a session",
430+
operationId: "session.messages",
418431
responses: {
419432
200: {
420433
description: "List of messages",
@@ -448,6 +461,7 @@ export namespace Server {
448461
"/session/:id/message",
449462
describeRoute({
450463
description: "Create and send a new message to a session",
464+
operationId: "session.chat",
451465
responses: {
452466
200: {
453467
description: "Created message",
@@ -477,6 +491,7 @@ export namespace Server {
477491
"/session/:id/revert",
478492
describeRoute({
479493
description: "Revert a message",
494+
operationId: "session.revert",
480495
responses: {
481496
200: {
482497
description: "Updated session",
@@ -506,6 +521,7 @@ export namespace Server {
506521
"/session/:id/unrevert",
507522
describeRoute({
508523
description: "Restore all reverted messages",
524+
operationId: "session.unrevert",
509525
responses: {
510526
200: {
511527
description: "Updated session",
@@ -533,6 +549,7 @@ export namespace Server {
533549
"/config/providers",
534550
describeRoute({
535551
description: "List all providers",
552+
operationId: "config.providers",
536553
responses: {
537554
200: {
538555
description: "List of providers",
@@ -561,6 +578,7 @@ export namespace Server {
561578
"/find",
562579
describeRoute({
563580
description: "Find text in files",
581+
operationId: "find.text",
564582
responses: {
565583
200: {
566584
description: "Matches",
@@ -593,6 +611,7 @@ export namespace Server {
593611
"/find/file",
594612
describeRoute({
595613
description: "Find files",
614+
operationId: "find.files",
596615
responses: {
597616
200: {
598617
description: "File paths",
@@ -625,6 +644,7 @@ export namespace Server {
625644
"/find/symbol",
626645
describeRoute({
627646
description: "Find workspace symbols",
647+
operationId: "find.symbols",
628648
responses: {
629649
200: {
630650
description: "Symbols",
@@ -652,6 +672,7 @@ export namespace Server {
652672
"/file",
653673
describeRoute({
654674
description: "Read a file",
675+
operationId: "file.read",
655676
responses: {
656677
200: {
657678
description: "File content",
@@ -688,6 +709,7 @@ export namespace Server {
688709
"/file/status",
689710
describeRoute({
690711
description: "Get file status",
712+
operationId: "file.status",
691713
responses: {
692714
200: {
693715
description: "File status",
@@ -708,6 +730,7 @@ export namespace Server {
708730
"/log",
709731
describeRoute({
710732
description: "Write a log entry to the server logs",
733+
operationId: "app.log",
711734
responses: {
712735
200: {
713736
description: "Log entry written successfully",
@@ -757,6 +780,7 @@ export namespace Server {
757780
"/mode",
758781
describeRoute({
759782
description: "List all modes",
783+
operationId: "app.modes",
760784
responses: {
761785
200: {
762786
description: "List of modes",
@@ -777,6 +801,7 @@ export namespace Server {
777801
"/tui/append-prompt",
778802
describeRoute({
779803
description: "Append prompt to the TUI",
804+
operationId: "tui.appendPrompt",
780805
responses: {
781806
200: {
782807
description: "Prompt processed successfully",
@@ -800,6 +825,7 @@ export namespace Server {
800825
"/tui/open-help",
801826
describeRoute({
802827
description: "Open the help dialog",
828+
operationId: "tui.openHelp",
803829
responses: {
804830
200: {
805831
description: "Help dialog opened successfully",

packages/sdk/.devcontainer/devcontainer.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/sdk/.prettierignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/sdk/.prettierrc.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)