mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-26 12:14:20 +01:00
ci: test
This commit is contained in:
@@ -156,8 +156,7 @@ export const TuiCommand = cmd({
|
||||
})
|
||||
|
||||
;(async () => {
|
||||
if (Installation.isDev()) return
|
||||
if (Installation.isPreview()) return
|
||||
if (Installation.isLocal()) return
|
||||
const config = await Config.global()
|
||||
if (config.autoupdate === false || Flag.OPENCODE_DISABLE_AUTOUPDATE) return
|
||||
const latest = await Installation.latest().catch(() => {})
|
||||
@@ -214,7 +213,7 @@ function getOpencodeCommand(): string[] {
|
||||
|
||||
const execPath = process.execPath.toLowerCase()
|
||||
|
||||
if (Installation.isDev()) {
|
||||
if (Installation.isLocal()) {
|
||||
// In development, use bun to run the TypeScript entry point
|
||||
return [execPath, "run", process.argv[1]]
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ export namespace Config {
|
||||
}
|
||||
|
||||
async function installDependencies(dir: string) {
|
||||
if (Installation.isDev()) return
|
||||
if (Installation.isLocal()) return
|
||||
|
||||
const pkg = path.join(dir, "package.json")
|
||||
|
||||
@@ -151,7 +151,7 @@ export namespace Config {
|
||||
if (!hasGitIgnore) await Bun.write(gitignore, ["node_modules", "package.json", "bun.lock", ".gitignore"].join("\n"))
|
||||
|
||||
await BunProc.run(
|
||||
["add", "@opencode-ai/plugin@" + (Installation.isDev() ? "latest" : Installation.VERSION), "--exact"],
|
||||
["add", "@opencode-ai/plugin@" + (Installation.isLocal() ? "latest" : Installation.VERSION), "--exact"],
|
||||
{
|
||||
cwd: dir,
|
||||
},
|
||||
|
||||
@@ -51,10 +51,10 @@ const cli = yargs(hideBin(process.argv))
|
||||
.middleware(async (opts) => {
|
||||
await Log.init({
|
||||
print: process.argv.includes("--print-logs"),
|
||||
dev: Installation.isDev(),
|
||||
dev: Installation.isLocal(),
|
||||
level: (() => {
|
||||
if (opts.logLevel) return opts.logLevel as Log.Level
|
||||
if (Installation.isDev()) return "DEBUG"
|
||||
if (Installation.isLocal()) return "DEBUG"
|
||||
return "INFO"
|
||||
})(),
|
||||
})
|
||||
|
||||
@@ -42,11 +42,11 @@ export namespace Installation {
|
||||
}
|
||||
|
||||
export function isPreview() {
|
||||
return VERSION.startsWith("0.0.0")
|
||||
return CHANNEL !== "latest"
|
||||
}
|
||||
|
||||
export function isDev() {
|
||||
return VERSION === "dev"
|
||||
export function isLocal() {
|
||||
return typeof OPENCODE_CHANNEL !== "string"
|
||||
}
|
||||
|
||||
export async function method() {
|
||||
|
||||
@@ -67,7 +67,7 @@ export namespace Share {
|
||||
|
||||
export const URL =
|
||||
process.env["OPENCODE_API"] ??
|
||||
(Installation.isPreview() || Installation.isDev() ? "https://api.dev.opencode.ai" : "https://api.opencode.ai")
|
||||
(Installation.isPreview() || Installation.isLocal() ? "https://api.dev.opencode.ai" : "https://api.opencode.ai")
|
||||
|
||||
export async function create(sessionID: string) {
|
||||
return fetch(`${URL}/share_create`, {
|
||||
|
||||
Reference in New Issue
Block a user