Skip to content

Commit 12ce53f

Browse files
committed
makefile changes
1 parent e8af2e3 commit 12ce53f

File tree

19 files changed

+2120
-1914
lines changed

19 files changed

+2120
-1914
lines changed

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,13 @@
66
**/__pycache__/**
77
private.*
88
.venv
9-
**/temp/
9+
10+
# Temporary directories
11+
**/temp/
12+
**/tmp/
13+
temp/
14+
tmp/
15+
16+
# Specific transport ignores
17+
transports/bifrost-http/logs/
18+
transports/bifrost-http/tmp/

.prettierrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"root": true,
3+
"printWidth": 140,
4+
"singleQuote": true,
5+
"semi": false,
6+
"bracketSpacing": true,
7+
"bracketSameLine": false,
8+
"useTabs": false,
9+
"tabWidth": 2,
10+
"trailingComma": "all",
11+
"plugins": [
12+
"prettier-plugin-tailwindcss"
13+
],
14+
"tailwindFunctions": [
15+
"cn",
16+
"classNames"
17+
]
18+
}

Makefile

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Makefile for Bifrost
2+
3+
# Variables
4+
CONFIG_FILE ?= transports/config.example.json
5+
PORT ?= 8080
6+
POOL_SIZE ?= 300
7+
PLUGINS ?= maxim
8+
PROMETHEUS_LABELS ?=
9+
10+
# Colors for output
11+
RED=\033[0;31m
12+
GREEN=\033[0;32m
13+
YELLOW=\033[1;33m
14+
BLUE=\033[0;34m
15+
CYAN=\033[0;36m
16+
NC=\033[0m # No Color
17+
18+
.PHONY: help dev dev-ui build run install-air clean test install-ui
19+
20+
# Default target
21+
help: ## Show this help message
22+
@echo "$(BLUE)Bifrost Development - Available Commands:$(NC)"
23+
@echo ""
24+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-15s$(NC) %s\n", $$1, $$2}'
25+
@echo ""
26+
@echo "$(YELLOW)Environment Variables:$(NC)"
27+
@echo " CONFIG_FILE Path to config file (default: transports/config.example.json)"
28+
@echo " PORT Server port (default: 8080)"
29+
@echo " POOL_SIZE Connection pool size (default: 300)"
30+
@echo " PLUGINS Comma-separated plugins to load (default: maxim)"
31+
@echo " PROMETHEUS_LABELS Labels for Prometheus metrics"
32+
33+
34+
install-ui:
35+
@which node > /dev/null || (echo "$(RED)Error: Node.js is not installed. Please install Node.js first.$(NC)" && exit 1)
36+
@which npm > /dev/null || (echo "$(RED)Error: npm is not installed. Please install npm first.$(NC)" && exit 1)
37+
@echo "$(GREEN)Node.js and npm are installed$(NC)"
38+
@cd ui && npm install
39+
@which next > /dev/null || (echo "$(YELLOW)Installing nextjs...$(NC)" && npm install -g next)
40+
@echo "$(GREEN)UI deps are in sync$(NC)"
41+
42+
install-air: ## Install air for hot reloading (if not already installed)
43+
@which air > /dev/null || (echo "$(YELLOW)Installing air for hot reloading...$(NC)" && go install github.com/air-verse/air@latest)
44+
@echo "$(GREEN)Air is ready$(NC)"
45+
46+
dev-http: install-ui install-air ## Start complete development environment (UI + API with proxy)
47+
@echo "$(GREEN)Starting Bifrost complete development environment...$(NC)"
48+
@echo "$(YELLOW)This will start:$(NC)"
49+
@echo " 1. UI development server (localhost:3000)"
50+
@echo " 2. API server with UI proxy (localhost:$(PORT)/ui)"
51+
@echo "$(CYAN)Access everything at: http://localhost:$(PORT)/ui$(NC)"
52+
@echo ""
53+
@echo "$(YELLOW)Starting UI development server...$(NC)"
54+
@cd ui && npm run dev &
55+
@sleep 3
56+
@echo "$(YELLOW)Starting API server with UI proxy...$(NC)"
57+
@cd transports/bifrost-http && BIFROST_UI_DEV=true air -c .air.toml -- \
58+
-port "$(PORT)" \
59+
-plugins "$(PLUGINS)" \
60+
$(if $(PROMETHEUS_LABELS),-prometheus-labels "$(PROMETHEUS_LABELS)")
61+
62+
build: ## Build bifrost-http binary
63+
@echo "$(GREEN)Building bifrost-http...$(NC)"
64+
@cd transports/bifrost-http && go build -o ../../tmp/bifrost-http .
65+
@echo "$(GREEN)Built: tmp/bifrost-http$(NC)"
66+
67+
run: build ## Build and run bifrost-http (no hot reload)
68+
@echo "$(GREEN)Running bifrost-http...$(NC)"
69+
@./tmp/bifrost-http \
70+
-config "$(CONFIG_FILE)" \
71+
-port "$(PORT)" \
72+
-pool-size $(POOL_SIZE) \
73+
-plugins "$(PLUGINS)" \
74+
$(if $(PROMETHEUS_LABELS),-prometheus-labels "$(PROMETHEUS_LABELS)")
75+
76+
77+
clean: ## Clean build artifacts and temporary files
78+
@echo "$(YELLOW)Cleaning build artifacts...$(NC)"
79+
@rm -rf tmp/
80+
@rm -f transports/bifrost-http/build-errors.log
81+
@rm -rf transports/bifrost-http/tmp/
82+
@echo "$(GREEN)Clean complete$(NC)"
83+
84+
test: ## Run tests for bifrost-http
85+
@echo "$(GREEN)Running bifrost-http tests...$(NC)"
86+
@cd transports/bifrost-http && go test -v ./...
87+
88+
test-core: ## Run core tests
89+
@echo "$(GREEN)Running core tests...$(NC)"
90+
@cd core && go test -v ./...
91+
92+
test-plugins: ## Run plugin tests
93+
@echo "$(GREEN)Running plugin tests...$(NC)"
94+
@cd plugins && find . -name "*.go" -path "*/tests/*" -o -name "*_test.go" | head -1 > /dev/null && \
95+
for dir in $$(find . -name "*_test.go" -exec dirname {} \; | sort -u); do \
96+
echo "Testing $$dir..."; \
97+
cd $$dir && go test -v ./... && cd - > /dev/null; \
98+
done || echo "No plugin tests found"
99+
100+
test-all: test-core test-plugins test ## Run all tests
101+
102+
# Quick start with example config
103+
quick-start: ## Quick start with example config and maxim plugin
104+
@echo "$(GREEN)Quick starting Bifrost with example configuration...$(NC)"
105+
@$(MAKE) dev CONFIG_FILE=transports/config.example.json PLUGINS=maxim
106+
107+
# Docker targets
108+
docker-build: ## Build Docker image
109+
@echo "$(GREEN)Building Docker image...$(NC)"
110+
@cd transports && docker build -t bifrost .
111+
@echo "$(GREEN)Docker image built: bifrost$(NC)"
112+
113+
docker-run: ## Run Docker container
114+
@echo "$(GREEN)Running Docker container...$(NC)"
115+
@docker run -p $(PORT):$(PORT) \
116+
-v $(PWD)/$(CONFIG_FILE):/app/config/config.json \
117+
--env-file <(env | grep -E '^(OPENAI|ANTHROPIC|AZURE|AWS|COHERE|VERTEX)_') \
118+
bifrost
119+
120+
# Linting and formatting
121+
lint: ## Run linter for Go code
122+
@echo "$(GREEN)Running golangci-lint...$(NC)"
123+
@golangci-lint run ./...
124+
125+
fmt: ## Format Go code
126+
@echo "$(GREEN)Formatting Go code...$(NC)"
127+
@gofmt -s -w .
128+
@goimports -w .
129+
130+
# Git hooks and development setup
131+
setup-git-hooks: ## Set up Git hooks for development
132+
@echo "$(GREEN)Setting up Git hooks...$(NC)"
133+
@echo "#!/bin/sh\nmake fmt\nmake lint" > .git/hooks/pre-commit
134+
@chmod +x .git/hooks/pre-commit
135+
@echo "$(GREEN)Git hooks installed$(NC)"

transports/bifrost-http/.air.toml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
root = "."
2+
testdata_dir = "testdata"
3+
tmp_dir = "./tmp"
4+
5+
[build]
6+
args_bin = []
7+
bin = "./tmp/main"
8+
cmd = "go build -o ./tmp/main ."
9+
delay = 1000
10+
exclude_dir = ["assets", "tmp", "vendor", "testdata", "ui", "node_modules"]
11+
exclude_file = []
12+
exclude_regex = ["_test.go"]
13+
exclude_unchanged = false
14+
follow_symlink = false
15+
full_bin = ""
16+
include_dir = []
17+
include_ext = ["go", "tpl", "tmpl", "html"]
18+
include_file = []
19+
kill_delay = "0s"
20+
log = "build-errors.log"
21+
poll = false
22+
poll_interval = 0
23+
rerun = false
24+
rerun_delay = 500
25+
send_interrupt = false
26+
stop_on_root = false
27+
28+
[color]
29+
app = ""
30+
build = "yellow"
31+
main = "magenta"
32+
runner = "green"
33+
watcher = "cyan"
34+
35+
[log]
36+
main_only = false
37+
time = false
38+
39+
[misc]
40+
clean_on_exit = false
41+
42+
[proxy]
43+
enabled = false
44+
proxy_port = 8090
45+
app_port = 8080
46+
47+
[screen]
48+
clear_on_rebuild = false
49+
keep_scroll = true
50+
51+
# Watch directories
52+
[[build.watch_dirs]]
53+
dir = "."
54+
55+
[[build.watch_dirs]]
56+
dir = "../../core"
57+
58+
[[build.watch_dirs]]
59+
dir = "./handlers"
60+
61+
[[build.watch_dirs]]
62+
dir = "./integrations"
63+
64+
[[build.watch_dirs]]
65+
dir = "./lib"
66+
67+
[[build.watch_dirs]]
68+
dir = "./plugins"

ui/.prettierrc

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

ui/app/config/page.tsx

Lines changed: 13 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,17 @@
1-
"use client";
1+
'use client'
22

3-
import { useState, useEffect } from "react";
4-
import Header from "@/components/header";
5-
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
6-
import { Badge } from "@/components/ui/badge";
7-
import { Settings, Database, Zap } from "lucide-react";
8-
import { useToast } from "@/hooks/use-toast";
9-
import { ProviderResponse } from "@/lib/types/config";
10-
import { apiService } from "@/lib/api";
11-
import CoreSettingsList from "@/components/config/core-settings-list";
12-
import ProvidersList from "@/components/config/providers-list";
13-
import MCPClientsList from "@/components/config/mcp-clients-lists";
14-
import { MCPClient } from "@/lib/types/mcp";
15-
import FullPageLoader from "@/components/full-page-loader";
3+
import CoreSettingsList from '@/components/config/core-settings-list'
164

175
export default function ConfigPage() {
18-
const [activeTab, setActiveTab] = useState("providers");
19-
const [isLoadingProviders, setIsLoadingProviders] = useState(true);
20-
const [isLoadingMcpClients, setIsLoadingMcpClients] = useState(true);
21-
const [providers, setProviders] = useState<ProviderResponse[]>([]);
22-
const [mcpClients, setMcpClients] = useState<MCPClient[]>([]);
23-
24-
const { toast } = useToast();
25-
26-
// Load configuration data
27-
useEffect(() => {
28-
loadProviders();
29-
loadMcpClients();
30-
}, []);
31-
32-
const loadProviders = async () => {
33-
const [data, error] = await apiService.getProviders();
34-
setIsLoadingProviders(false);
35-
36-
if (error) {
37-
toast({
38-
title: "Error",
39-
description: error,
40-
variant: "destructive",
41-
});
42-
return;
43-
}
44-
setProviders(data?.providers || []);
45-
};
46-
47-
const loadMcpClients = async () => {
48-
const [data, error] = await apiService.getMCPClients();
49-
setIsLoadingMcpClients(false);
50-
51-
if (error) {
52-
toast({
53-
title: "Error",
54-
description: error,
55-
variant: "destructive",
56-
});
57-
return;
58-
}
59-
60-
setMcpClients(data || []);
61-
};
62-
63-
return (
64-
<div className="bg-background">
65-
{isLoadingProviders || isLoadingMcpClients ? (
66-
<FullPageLoader />
67-
) : (
68-
<div className="space-y-6">
69-
{/* Page Header */}
70-
<div>
71-
<h1 className="text-3xl font-bold">Configuration</h1>
72-
<p className="text-muted-foreground mt-2">Configure AI providers, API keys, and system settings for your Bifrost instance.</p>
73-
</div>
74-
75-
{/* Configuration Tabs */}
76-
<Tabs value={activeTab} onValueChange={setActiveTab} className="space-y-6">
77-
<TabsList className="grid h-12 w-full grid-cols-3">
78-
<TabsTrigger value="providers" className="flex items-center gap-2">
79-
<Database className="h-4 w-4" />
80-
Providers
81-
<Badge variant="default" className="ml-1">
82-
{providers.length}
83-
</Badge>
84-
</TabsTrigger>
85-
<TabsTrigger value="mcp" className="flex items-center gap-2">
86-
<Zap className="h-4 w-4" />
87-
MCP Clients
88-
{mcpClients.length > 0 && (
89-
<Badge variant="default" className="ml-1">
90-
{mcpClients.length}
91-
</Badge>
92-
)}
93-
</TabsTrigger>
94-
<TabsTrigger value="core" className="flex items-center gap-2">
95-
<Settings className="h-4 w-4" />
96-
Core Settings
97-
</TabsTrigger>
98-
</TabsList>
99-
100-
{/* Providers Tab */}
101-
<TabsContent value="providers" className="space-y-4">
102-
<ProvidersList providers={providers} onRefresh={loadProviders} />
103-
</TabsContent>
104-
105-
{/* MCP Tools Tab */}
106-
<TabsContent value="mcp" className="space-y-4">
107-
<MCPClientsList />
108-
</TabsContent>
109-
110-
{/* Core Settings Tab */}
111-
<TabsContent value="core" className="space-y-4">
112-
<CoreSettingsList />
113-
</TabsContent>
114-
</Tabs>
115-
</div>
116-
)}
117-
</div>
118-
);
6+
return (
7+
<div className="bg-background space-y-6">
8+
{/* Page Header */}
9+
<div>
10+
<h1 className="text-3xl font-bold">Configuration</h1>
11+
<p className="text-muted-foreground mt-2">Configure AI providers, API keys, and system settings for your Bifrost instance.</p>
12+
</div>
13+
14+
<CoreSettingsList />
15+
</div>
16+
)
11917
}

0 commit comments

Comments
 (0)