mirror of
https://github.com/browseros-ai/BrowserOS.git
synced 2026-05-14 08:03:58 +00:00
Compare commits
1 Commits
fix/bdev-1
...
fix/balpha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c02cdab095 |
@@ -2,11 +2,15 @@ BINARY := balpha
|
||||
SOURCES := $(shell find . -name '*.go') go.mod go.sum
|
||||
PREFIX ?= $(HOME)/bin
|
||||
|
||||
all: build
|
||||
|
||||
build: $(BINARY)
|
||||
|
||||
$(BINARY): $(SOURCES)
|
||||
@echo "[build] Compiling $(BINARY)..."
|
||||
@go build -o $(BINARY) .
|
||||
|
||||
.PHONY: install test clean
|
||||
.PHONY: all build install test clean
|
||||
|
||||
install: $(BINARY)
|
||||
@mkdir -p $(PREFIX)
|
||||
|
||||
@@ -119,7 +119,7 @@ func runEnvironment(cfg config.Config, agentRoot string) error {
|
||||
Dir: serverDir,
|
||||
Env: env,
|
||||
Restart: true,
|
||||
Cmd: []string{"bun", "--watch", "--env-file=.env.development", "src/index.ts"},
|
||||
Cmd: serverCommand(),
|
||||
}))
|
||||
printSummary(cfg, agentRoot)
|
||||
|
||||
@@ -157,6 +157,10 @@ func runEnvironment(cfg config.Config, agentRoot string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func serverCommand() []string {
|
||||
return []string{"bun", "--env-file=.env.development", "src/index.ts"}
|
||||
}
|
||||
|
||||
func exists(path string) bool {
|
||||
_, err := os.Stat(path)
|
||||
return err == nil
|
||||
|
||||
14
packages/browseros-agent/tools/alpha/cmd/start_test.go
Normal file
14
packages/browseros-agent/tools/alpha/cmd/start_test.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestServerCommandDoesNotWatchFiles(t *testing.T) {
|
||||
got := serverCommand()
|
||||
want := []string{"bun", "--env-file=.env.development", "src/index.ts"}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Fatalf("server command got %#v want %#v", got, want)
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ func DefaultProductionEnv() ProductionEnv {
|
||||
"R2_DOWNLOAD_PREFIX": "artifacts/vendor",
|
||||
"R2_UPLOAD_PREFIX": "artifacts/server",
|
||||
"NODE_ENV": "production",
|
||||
"LOG_LEVEL": "info",
|
||||
"LOG_LEVEL": "debug",
|
||||
},
|
||||
CLI: map[string]string{
|
||||
"POSTHOG_API_KEY": "",
|
||||
@@ -203,7 +203,7 @@ func DefaultProductionEnv() ProductionEnv {
|
||||
"R2_ACCESS_KEY_ID": "",
|
||||
"R2_SECRET_ACCESS_KEY": "",
|
||||
"R2_BUCKET": "browseros",
|
||||
"R2_UPLOAD_PREFIX": "cli",
|
||||
"R2_UPLOAD_PREFIX": "",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,9 +29,15 @@ func TestDefaults(t *testing.T) {
|
||||
if cfg.ProductionEnv.Server["BROWSEROS_CONFIG_URL"] == "" {
|
||||
t.Fatalf("missing server production env defaults: %#v", cfg.ProductionEnv.Server)
|
||||
}
|
||||
if cfg.ProductionEnv.Server["LOG_LEVEL"] != "debug" {
|
||||
t.Fatalf("server log level got %q want debug", cfg.ProductionEnv.Server["LOG_LEVEL"])
|
||||
}
|
||||
if cfg.ProductionEnv.CLI["R2_BUCKET"] != "browseros" {
|
||||
t.Fatalf("missing cli production env defaults: %#v", cfg.ProductionEnv.CLI)
|
||||
}
|
||||
if cfg.ProductionEnv.CLI["R2_UPLOAD_PREFIX"] != "" {
|
||||
t.Fatalf("cli upload prefix got %q want empty", cfg.ProductionEnv.CLI["R2_UPLOAD_PREFIX"])
|
||||
}
|
||||
}
|
||||
|
||||
func TestSaveLoadRoundTrip(t *testing.T) {
|
||||
|
||||
@@ -15,11 +15,11 @@ func TestWriteProductionEnvFiles(t *testing.T) {
|
||||
ProductionEnv: config.ProductionEnv{
|
||||
Server: map[string]string{
|
||||
"NODE_ENV": "production",
|
||||
"LOG_LEVEL": "info",
|
||||
"LOG_LEVEL": "debug",
|
||||
},
|
||||
CLI: map[string]string{
|
||||
"R2_BUCKET": "browseros",
|
||||
"R2_UPLOAD_PREFIX": "cli",
|
||||
"R2_UPLOAD_PREFIX": "",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -29,11 +29,11 @@ func TestWriteProductionEnvFiles(t *testing.T) {
|
||||
assertMode(t, filepath.Join(root, "apps/server/.env.production"), 0600)
|
||||
assertMode(t, filepath.Join(root, "apps/cli/.env.production"), 0600)
|
||||
assertContains(t, filepath.Join(root, "apps/server/.env.production"), "BROWSEROS_CONFIG_URL=https://llm.browseros.com/api/browseros-server/config\n")
|
||||
assertContains(t, filepath.Join(root, "apps/server/.env.production"), "LOG_LEVEL=info\n")
|
||||
assertContains(t, filepath.Join(root, "apps/server/.env.production"), "LOG_LEVEL=debug\n")
|
||||
assertContains(t, filepath.Join(root, "apps/server/.env.production"), "NODE_ENV=production\n")
|
||||
assertContains(t, filepath.Join(root, "apps/cli/.env.production"), "POSTHOG_API_KEY=\n")
|
||||
assertContains(t, filepath.Join(root, "apps/cli/.env.production"), "R2_BUCKET=browseros\n")
|
||||
assertContains(t, filepath.Join(root, "apps/cli/.env.production"), "R2_UPLOAD_PREFIX=cli\n")
|
||||
assertContains(t, filepath.Join(root, "apps/cli/.env.production"), "R2_UPLOAD_PREFIX=\n")
|
||||
}
|
||||
|
||||
func TestWriteEnvFileQuotesUnsafeValues(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user