Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# .env.example — copy relevant parts to .env.local and fill in secrets.
# .env.local is gitignored. Never commit secrets.
# For the CLI: these same BAUER_* vars work as flag fallbacks.

# --- Secrets (go in .env.local, never committed) ---
BAUER_GITHUB_TOKEN=ghp_...
BAUER_CREDENTIALS_PATH=/path/to/service-account.json

# --- Google credentials fallback ---
# GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json

# --- GitHub App (alternative to PAT, recommended for org repos) ---
# GITHUB_APP_ID=12345
# GITHUB_APP_PRIVATE_KEY_PATH=/path/to/private-key.pem
# GITHUB_APP_INSTALLATION_ID=67890

# --- OIDC (optional — for API deployments protected by your IdP) ---
# BAUER_OIDC_ISSUER=https://auth.example.com
# BAUER_OIDC_AUDIENCE=bauer-api

# --- Jira webhook ---
# BAUER_JIRA_WEBHOOK_SECRET=your-shared-secret
# BAUER_JIRA_DOC_FIELD=customfield_10100

# --- Figma integration (optional; required when --figma-url is used) ---
# BAUER_FIGMA_TOKEN=figd_xxxxxxxxxxxxx

# --- API Server ---
BAUER_API_PORT=8090

# --- Copilot / model ---
BAUER_MODEL=gpt-5-mini-high
BAUER_SUMMARY_MODEL=gpt-5-mini-high

# --- Bauer behaviour (env var fallbacks for CLI flags) ---
BAUER_DOC_ID=
BAUER_CHUNK_SIZE=1
BAUER_PAGE_REFRESH=false
BAUER_DRY_RUN=false
BAUER_OUTPUT_DIR=bauer-output
BAUER_BRANCH_PREFIX=bauer
BAUER_ARTIFACTS_DIR=./bauer-artifacts
BAUER_TARGET_REPO=
BAUER_FIGMA_URL=
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI

on:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
test-and-checks:
name: Test and checks
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- name: Verify formatting
run: |
unformatted="$(gofmt -l .)"
if [ -n "$unformatted" ]; then
echo "The following files are not formatted with gofmt:"
echo "$unformatted"
exit 1
fi

- name: Run go vet
run: go vet ./...

- name: Run tests
run: go test ./...

- name: Build CLI
run: go build ./cmd/bauer

- name: Build API
run: go build ./cmd/app
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,15 @@ bauer-output/
bauer
# Added by goreleaser init:
dist/

# Artifacts
bauer-artifacts/

.workshop.lock
config.json
credentials.json

# Binaries
bauer
bauer-api
app
1 change: 1 addition & 0 deletions .workshop.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
073716b8
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ From Repository root:

```bash
task build-api
./bauer-api --config config.json
./bauer-api
```

### Endpoints
Expand Down
42 changes: 24 additions & 18 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,43 @@ version: "3"

tasks:
build:
desc: Build the Bauer and Bauer API binaries
desc: Build the Bauer CLI binary
cmds:
- go build -o bauer cmd/bauer/main.go
- go build -o bauer-api cmd/app/main.go
- go build -o bauer ./cmd/bauer/

build-api:
desc: Build the Bauer API server binary
cmds:
- go build -o bauer-api ./cmd/app/

run:
desc: Run Bauer CLI in standalone mode
summary: |
Requires BAUER_DOC_ID and BAUER_CREDENTIALS_PATH (or GOOGLE_APPLICATION_CREDENTIALS, or --credentials flag).
Example: task run -- --doc-id 1abc --credentials ./creds.json
cmds:
- go run ./cmd/bauer/ {{.CLI_ARGS}}

run-api:
desc: Build and start the API server
cmds:
- task: build-api
- ./bauer-api

test:
desc: Run all tests
desc: Run all unit tests
cmds:
- go test --cover ./...
- go test ./...

lint:
desc: Format code using gofmt
cmds:
- gofmt -w .

run-server:
desc: Run the API server locally
cmds:
- ./bauer-api --config config.json

clean:
desc: Clean up generated files
cmds:
- rm -rf bauer-output
- rm -f bauer
- rm -f bauer bauer-api
- rm -f bauer.log
- rm -rf /tmp/gh* /tmp/tmp* /tmp/test-bauer-repo* || true

run:
desc: Clean up generated files, build and run Bauer server
cmds:
- task: clean
- task: build
- task: run-server
29 changes: 0 additions & 29 deletions cmd/app/core/middleware/request_trace.go

This file was deleted.

28 changes: 7 additions & 21 deletions cmd/app/main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
package main

import (
"bauer/cmd/app/core/middleware"
"bauer/cmd/app/types"
v1 "bauer/cmd/app/v1"
"bauer/internal/orchestrator"
"bauer/internal/workflow"
"fmt"
"log/slog"
"net/http"
Expand All @@ -20,24 +15,15 @@ func run() error {
slog.Info("startup", "status", "initializing API")
defer slog.Info("shutdown complete")

orchestrator := orchestrator.NewOrchestrator()
cfg, err := types.LoadConfig()
if err != nil {
slog.Error("failed to load config", "error", err.Error())
return err
}

rc := types.RouteConfig{
APIConfig: *cfg,
Orchestrator: orchestrator,
}

mux := http.NewServeMux()
mux.HandleFunc("/api/v1/job", v1.JobPost(rc))
mux.HandleFunc("/api/v1/health", v1.GetHealth)
mux.HandleFunc("/api/v1/workflow", workflow.ExecuteWorkflowHandler(orchestrator))
mux.HandleFunc("GET /api/v1/health", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
w.Write([]byte(`{"status":"ok"}`))
})

slog.Info("starting server", "address", ":8090")
err = http.ListenAndServe(":8090", middleware.RequestTrace(mux))
err := http.ListenAndServe(":8090", mux)

if err != nil {
slog.Error("server error", "error", err.Error())
Expand Down
14 changes: 0 additions & 14 deletions cmd/app/models/v1/job.go

This file was deleted.

75 changes: 0 additions & 75 deletions cmd/app/types/config.go

This file was deleted.

45 changes: 0 additions & 45 deletions cmd/app/types/response.go

This file was deleted.

Loading
Loading