Skip to content

Commit a431ab1

Browse files
committed
Finish OSS release pipeline
1 parent fe96b4a commit a431ab1

18 files changed

Lines changed: 102 additions & 134 deletions

.goreleaser.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ builds:
99
- -X main.version={{.Version}}
1010
- -X main.commit={{.ShortCommit}}
1111
- -X main.date={{.Date}}
12-
- -X main.baseImageTag=v{{.Version}}
12+
# The OSS repo does not publish matching base-image tags. Leave the
13+
# runtime on :latest unless a caller explicitly sets BACK2BASE_BASE_IMAGE.
14+
- -X main.baseImageTag=dev
1315
env:
1416
- CGO_ENABLED=0
1517
goos:

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
VERSION ?= dev
44
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "none")
55
DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
6-
LDFLAGS := -s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE) -X main.baseImageTag=$(VERSION)
6+
BASE_IMAGE_TAG ?= dev
7+
LDFLAGS := -s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE) -X main.baseImageTag=$(BASE_IMAGE_TAG)
78

89
# Build the binary
910
build:

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Anthropic API key works too — set `BACK2BASE_ANTHROPIC_API_KEY` in `~/.config/
3232

3333
## What's included
3434

35-
- **CLI commands**: `run` (default), `shell`, `doctor`, `explore`, `profile`, `prune`, `mcp`, `overview`, `update`, `selfupdate`, `install`, `setup`, `clean`, `resume`, `status`, `build`/`rebuild`, `session`, `version`.
35+
- **CLI commands**: `run` (default), `shell`, `doctor`, `profile`, `prune`, `mcp`, `overview`, `update`, `selfupdate`, `install`, `setup`, `clean`, `resume`, `status`, `build`/`rebuild`, `session`, `version`.
3636
- **Container payload** (`back2base-container/`): Dockerfile, docker-compose, entrypoint, iptables-based outbound firewall, MCP profile defaults, baseline `CLAUDE.md` template, skills + slash-command bundle.
3737
- **GitHub Actions**: `ci.yml` (go test/vet, lint, cross-build matrix) and `release.yml` (goreleaser on tag push).
3838

@@ -41,7 +41,8 @@ Anthropic API key works too — set `BACK2BASE_ANTHROPIC_API_KEY` in `~/.config/
4141
- `auth0/`, `auth.go`, `login.go`, the device-flow code, and the host keychain credential store — all removed.
4242
- `workers/` (Cloudflare Workers for proxy, config, memory, landing site) — never copied.
4343
- `lib/cloud-sync.sh`, `lib/hooks/memory-push.sh`, `lib/hooks/memory-pull.sh` — removed from the container payload.
44-
- OTel telemetry to `otel.back2base.net` — disabled by default; users can point `BACK2BASE_OTEL_ENDPOINT` at their own collector.
44+
- Hosted telemetry defaults — removed. OTel is disabled unless users point
45+
`BACK2BASE_OTEL_ENDPOINT` at their own collector.
4546

4647
## Repository layout
4748

back2base-container/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ COPY --chown=node:node defaults/CLAUDE.md.template /opt/back2base/defaults/CLAUD
3535
COPY --chown=node:node defaults/profile-snippets/ /opt/back2base/defaults/profile-snippets/
3636

3737
# Hook scripts (power-steering-drain, claude-md-audit, and shared lib).
38-
# Memory/cloud-sync hooks are not shipped in the OSS build.
3938
COPY --chown=node:node --chmod=0755 lib/hooks/ /opt/back2base/hooks/
4039

4140
# Session snapshot daemon — invoked by absolute path from entrypoint.sh

back2base-container/defaults/CLAUDE.md.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ If the user says "remember this" or "save X", treat that as one case among many
6767

6868
Use the `Write` tool to create a file at `~/.claude/projects/$MEMORY_NAMESPACE/memory/<slug>_<YYYY-MM-DD>_<hash>.md`, where:
6969

70-
- `<slug>` is a short kebab- or snake-case name for the topic (e.g. `user_role`, `feedback_testing`, `auth0_tenant_setup`).
70+
- `<slug>` is a short kebab- or snake-case name for the topic (e.g. `user_role`, `feedback_testing`, `billing_setup`).
7171
- `<YYYY-MM-DD>` is today's UTC date — get it via `date -u +%F`.
7272
- `<hash>` is the first 8 chars of the sha256 of the body you're about to write — `printf '%s' "$body" | shasum -a 256 | head -c 8`.
7373

back2base-container/docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ services:
6262
- /var/run/docker.sock:/var/run/docker.sock
6363

6464
# Add the docker daemon's socket GID as a supplementary group on the node
65-
# user so it can read /var/run/docker.sock without sudo. bin/back2base
65+
# user so it can read /var/run/docker.sock without sudo. oss-back2base
6666
# probes the active daemon at every launch (Colima → ~991 docker group,
6767
# Docker Desktop → 0 root) and exports BACK2BASE_DOCKER_GID; the cache
6868
# at $BACK2BASE_STATE/docker-gid is a fallback if the probe fails.
@@ -72,11 +72,11 @@ services:
7272
- "${BACK2BASE_DOCKER_GID:-999}"
7373

7474
environment:
75-
# Auth — long-lived OAuth token from `back2base login`, or an API key.
75+
# Auth — long-lived Claude Code OAuth token, or an API key.
7676
# Source is the BACK2BASE_<NAME> variant only: the user's bare
7777
# ANTHROPIC_API_KEY / CLAUDE_CODE_OAUTH_TOKEN / etc. (in their shell
7878
# or in random tools' env files) is intentionally NOT picked up, so
79-
# back2base can't accidentally inherit a credential the user meant
79+
# oss-back2base can't accidentally inherit a credential the user meant
8080
# for something else. The container still receives the unprefixed
8181
# name because that's what Claude Code reads.
8282
- CLAUDE_CODE_OAUTH_TOKEN=${BACK2BASE_CLAUDE_CODE_OAUTH_TOKEN:-}

back2base-container/lib/power-steering-prompt.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ text or dispatching a Plan subagent.
5252

5353
**Looks like:**
5454
```
55-
- ORIGINAL TASK: "rewrite the auth flow to use Auth0 instead of Cognito,
56-
it touches the worker, the client, and the migrations"
55+
- ORIGINAL TASK: "rewrite the billing flow to use Stripe Checkout instead
56+
of invoices, it touches the worker, the client, and the migrations"
5757
- 1st assistant turn: tool_use: Edit(file="...auth.ts")
5858
- 2nd assistant turn: tool_use: Edit(file="...config.ts")
5959
- (no plan stated, no Plan subagent dispatched)

baseimage.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ import (
66
"os/exec"
77
)
88

9-
// baseImageTag is injected via ldflags at release time (Makefile and
10-
// .goreleaser.yml wire it to the same string as main.version, which for
11-
// goreleaser is `v<semver>`). When built locally without LDFLAGS it stays
12-
// "dev", which resolveBaseImage treats as "no pin" and falls back to
13-
// :latest for local iteration.
9+
// baseImageTag may be injected via ldflags by downstream release builds. The
10+
// OSS release pipeline leaves it as "dev" so resolveBaseImage falls back to the
11+
// public :latest base image instead of requiring this repo to publish matching
12+
// base-image tags.
1413
var baseImageTag = "dev"
1514

1615
const baseImageRepo = "ramseymcgrath/back2base-base"
@@ -19,9 +18,9 @@ const baseImageRepo = "ramseymcgrath/back2base-base"
1918
// compose runtime should build on top of. Precedence:
2019
// 1. BACK2BASE_BASE_IMAGE env var (explicit caller override — supports local
2120
// testing against a custom image).
22-
// 2. The binary's embedded baseImageTag (release builds pin to the matching
23-
// semver tag published by .github/workflows/base-image.yml on that tag).
24-
// 3. :latest — dev builds and any release whose ldflag wiring drops out.
21+
// 2. The binary's embedded baseImageTag, when a downstream build chooses to
22+
// pin one.
23+
// 3. :latest — OSS releases and local builds.
2524
func resolveBaseImage() string {
2625
if v := os.Getenv("BACK2BASE_BASE_IMAGE"); v != "" {
2726
return v
@@ -36,9 +35,8 @@ func resolveBaseImage() string {
3635
// daemon, pulling it if not. Silent on cache hit; on miss it streams the
3736
// pull to stderr so the user sees why the first launch takes a minute.
3837
//
39-
// Called before compose build/run so the pinned-by-version contract is
40-
// real: a user on back2base v0.17.1 will end up running on
41-
// back2base-base:v0.17.1 even if their daemon has never seen that tag.
38+
// Called before compose build/run so first launch pulls the base image when the
39+
// daemon has not already cached it.
4240
func ensureBaseImage(image string) error {
4341
if err := exec.Command("docker", "image", "inspect", image).Run(); err == nil {
4442
return nil

clean.go

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var cleanCmd = &cobra.Command{
1818

1919
var wipeCmd = &cobra.Command{
2020
Use: "wipe-images",
21-
Short: "Nuke ALL back2base containers and images",
21+
Short: "Nuke ALL oss-back2base containers and images",
2222
RunE: runWipe,
2323
}
2424

@@ -46,31 +46,38 @@ func runClean(cmd *cobra.Command, args []string) error {
4646
func runWipe(cmd *cobra.Command, args []string) error {
4747
cfg := resolveConfig()
4848

49-
// Find back2base images
49+
// Find oss-back2base/back2base-compatible images.
5050
imgOut, _ := exec.Command("docker", "images", "--format", "{{.Repository}}:{{.Tag}}").Output()
5151
var imageRefs []string
5252
for _, line := range strings.Split(string(imgOut), "\n") {
5353
line = strings.TrimSpace(line)
54-
if strings.HasPrefix(line, "back2base-claude") ||
54+
if strings.HasPrefix(line, "oss-back2base-claude") ||
55+
strings.HasPrefix(line, "back2base-claude") ||
5556
strings.HasPrefix(line, "ramseymcgrath/back2base-base") ||
5657
strings.HasPrefix(line, "back2base/back2base:") {
5758
imageRefs = append(imageRefs, line)
5859
}
5960
}
6061

61-
// Find back2base containers from image names and compose labels
62+
// Find oss-back2base/back2base-compatible containers from image names and
63+
// compose labels.
6264
ctrOut1, _ := exec.Command("docker", "ps", "-a",
6365
"--format", "{{.Names}}\t{{.Image}}").Output()
64-
ctrOut2, _ := exec.Command("docker", "ps", "-a",
66+
ctrOut2a, _ := exec.Command("docker", "ps", "-a",
6567
"--filter", "label=com.docker.compose.project=back2base",
6668
"--format", "{{.Names}}").Output()
69+
ctrOut2b, _ := exec.Command("docker", "ps", "-a",
70+
"--filter", "label=com.docker.compose.project=oss-back2base",
71+
"--format", "{{.Names}}").Output()
72+
ctrOut2 := append(ctrOut2a, ctrOut2b...)
6773

6874
containerSet := make(map[string]bool)
6975
for _, line := range strings.Split(string(ctrOut1), "\n") {
7076
parts := strings.SplitN(strings.TrimSpace(line), "\t", 2)
7177
if len(parts) == 2 {
7278
img := parts[1]
73-
if strings.HasPrefix(img, "back2base-claude") ||
79+
if strings.HasPrefix(img, "oss-back2base-claude") ||
80+
strings.HasPrefix(img, "back2base-claude") ||
7481
strings.HasPrefix(img, "back2base/back2base") {
7582
containerSet[parts[0]] = true
7683
}
@@ -89,7 +96,7 @@ func runWipe(cmd *cobra.Command, args []string) error {
8996
}
9097

9198
if len(imageRefs) == 0 && len(containers) == 0 {
92-
fmt.Println("No back2base containers or images found.")
99+
fmt.Println("No oss-back2base containers or images found.")
93100
return nil
94101
}
95102

@@ -140,6 +147,6 @@ func runWipe(cmd *cobra.Command, args []string) error {
140147
exec.Command("docker", rmiArgs...).Run()
141148
}
142149

143-
fmt.Println("Done. Next 'back2base' run will rebuild from source.")
150+
fmt.Println("Done. Next 'oss-back2base' run will rebuild from source.")
144151
return nil
145152
}

explore.go

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

0 commit comments

Comments
 (0)