mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-24 03:04:21 +01:00
wip: refactoring tui
This commit is contained in:
@@ -28,7 +28,7 @@ for (const [os, arch] of targets) {
|
||||
console.log(`building ${os}-${arch}`)
|
||||
const name = `${pkg.name}-${os}-${arch}`
|
||||
await $`mkdir -p dist/${name}/bin`
|
||||
await $`GOOS=${os} GOARCH=${GOARCH[arch]} go build -ldflags="-s -w -X github.com/sst/opencode/internal/version.Version=${version}" -o ../opencode/dist/${name}/bin/tui ../tui/main.go`.cwd(
|
||||
await $`GOOS=${os} GOARCH=${GOARCH[arch]} go build -ldflags="-s -w -X github.com/sst/opencode/internal/version.Version=${version}" -o ../opencode/dist/${name}/bin/tui ../tui/cmd/opencode/main.go`.cwd(
|
||||
"../tui",
|
||||
)
|
||||
await $`bun build --define OPENCODE_VERSION="'${version}'" --compile --minify --target=bun-${os}-${arch} --outfile=dist/${name}/bin/opencode ./src/index.ts ./dist/${name}/bin/tui`
|
||||
|
||||
@@ -24,7 +24,7 @@ cli.command("", "Start the opencode in interactive mode").action(async () => {
|
||||
const server = Server.listen()
|
||||
|
||||
let cmd = ["go", "run", "./main.go"]
|
||||
let cwd = new URL("../../tui", import.meta.url).pathname
|
||||
let cwd = new URL("../../tui/cmd/opencode", import.meta.url).pathname
|
||||
if (Bun.embeddedFiles.length > 0) {
|
||||
const blob = Bun.embeddedFiles[0] as File
|
||||
const binary = path.join(Global.cache(), "tui", blob.name)
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as path from "path"
|
||||
import { Tool } from "./tool"
|
||||
import { FileTimes } from "./util/file-times"
|
||||
import { LSP } from "../lsp"
|
||||
import { diffLines } from "diff"
|
||||
import { createTwoFilesPatch, diffLines } from "diff"
|
||||
import { Permission } from "../permission"
|
||||
|
||||
const DESCRIPTION = `Edits files by replacing text, creating new files, or deleting content. For moving or renaming files, use the Bash tool with the 'mv' command instead. For larger file edits, use the FileWrite tool to overwrite files.
|
||||
@@ -128,6 +128,7 @@ export const EditTool = Tool.define({
|
||||
})()
|
||||
|
||||
const changes = diffLines(contentOld, contentNew)
|
||||
const diff = createTwoFilesPatch(filePath, filePath, contentOld, contentNew)
|
||||
|
||||
FileTimes.read(ctx.sessionID, filePath)
|
||||
|
||||
@@ -147,6 +148,7 @@ export const EditTool = Tool.define({
|
||||
metadata: {
|
||||
diagnostics,
|
||||
changes,
|
||||
diff,
|
||||
},
|
||||
output,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user