This commit is contained in:
Dax Raad 2025-06-12 11:00:37 -04:00
parent b7b490f67c
commit 888105e60f
5 changed files with 43 additions and 19 deletions

View file

@ -1,12 +1,24 @@
#!/usr/bin/env bun
import { $ } from "bun"
import { Glob } from "bun"
import pkg from "../package.json"
const dry = process.argv.includes("--dry")
const snapshot = process.argv.includes("--snapshot")
const version = `0.0.0-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}`
const version = snapshot
? `0.0.0-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}`
: await $`git describe --tags --exact-match HEAD`
.text()
.then((x) => x.substring(1).trim())
.catch(() => {
console.error("tag not found")
process.exit(1)
})
console.log(`publishing ${version}`)
const GOARCH: Record<string, string> = {
arm64: "arm64",
@ -24,6 +36,7 @@ const targets = [
await $`rm -rf dist`
const optionalDependencies: Record<string, string> = {}
const npmTag = snapshot ? "snapshot" : "latest"
for (const [os, arch] of targets) {
console.log(`building ${os}-${arch}`)
const name = `${pkg.name}-${os}-${arch}`
@ -45,7 +58,8 @@ for (const [os, arch] of targets) {
2,
),
)
if (!dry) await $`cd dist/${name} && npm publish --access public --tag latest`
if (!dry)
await $`cd dist/${name} && npm publish --access public --tag ${npmTag}`
optionalDependencies[name] = version
}
@ -70,4 +84,14 @@ await Bun.file(`./dist/${pkg.name}/package.json`).write(
),
)
if (!dry)
await $`cd ./dist/${pkg.name} && npm publish --access public --tag latest`
await $`cd ./dist/${pkg.name} && npm publish --access public --tag ${npmTag}`
for (const key of Object.keys(optionalDependencies)) {
await $`cd dist/${key}/bin && zip -r ../../${key}.zip *`
}
// Upload to GitHub releases
const files = Object.keys(optionalDependencies)
.map((key) => `dist/${key}.zip`)
.join(" ")
await $`gh release create v${version} ${files} --title "Release v${version}" --generate-notes`

View file

@ -7,17 +7,12 @@ export namespace BunProc {
cmd: string[],
options?: Bun.SpawnOptions.OptionsObject<any, any, any>,
) {
const root =
process.argv0 !== "bun" && false
? path.resolve(process.cwd(), process.argv0)
: "bun"
log.info("running", {
cmd: [root, ...cmd],
cmd: [which(), ...cmd],
options,
})
const result = Bun.spawn([root, ...cmd], {
const result = Bun.spawn([which(), ...cmd], {
...options,
argv0: "bun",
env: {
...process.env,
...options?.env,
@ -31,4 +26,10 @@ export namespace BunProc {
}
return result
}
export function which() {
return process.argv0 !== "bun"
? path.resolve(process.cwd(), process.argv0)
: "bun"
}
}

View file

@ -3,6 +3,7 @@ import type { App } from "../app/app"
import path from "path"
import { Global } from "../global"
import { Log } from "../util/log"
import { BunProc } from "../bun"
export namespace LSPServer {
const log = Log.create({ service: "lsp.server" })
@ -37,15 +38,10 @@ export namespace LSPServer {
app.path.cwd,
).catch(() => {})
if (!tsserver) return
const root =
process.argv0 !== "bun" && false
? path.resolve(process.cwd(), process.argv0)
: "bun"
const proc = spawn(
root,
BunProc.which(),
["x", "typescript-language-server", "--stdio"],
{
argv0: "bun",
env: {
...process.env,
BUN_BE_BUN: "1",

View file

@ -259,11 +259,14 @@ export namespace Provider {
}
}
const priority = ["claude-sonnet-4", "gemini-2.5-pro-preview", "codex-mini"]
const priority = ["gemini-2.5-pro-preview", "codex-mini", "claude-sonnet-4"]
export function sort(models: Model[]) {
return sortBy(
models,
[(model) => priority.indexOf(model.id), "desc"],
[
(model) => priority.findIndex((filter) => model.id.includes(filter)),
"desc",
],
[(model) => (model.id.includes("latest") ? 0 : 1), "asc"],
[(model) => model.id, "desc"],
)

View file

@ -283,7 +283,7 @@ export namespace Session {
}
msgs.push(system)
generateText({
maxOutputTokens: 80,
maxOutputTokens: 20,
messages: convertToModelMessages([
{
role: "system",