Skip to content

feat(global): rebuild auto-brain as a Node 26 TypeScript monorepo - #46

Merged
SamHatoum merged 6 commits into
mainfrom
iteration-zero
Sep 30, 2026
Merged

SamHatoum merged 6 commits into
mainfrom
iteration-zero

Conversation

@SamHatoum

Copy link
Copy Markdown
Collaborator

Replaces the auto-agent plugin with the iteration-zero foundation for auto-brain: a Node server runtime, packaged as one container image that runs on Cloudflare Containers (the public offering) and on-prem.

The plugin's last state is preserved in BeOnAuto/auto-agent-backup at e50f420.

Layout

Path Package What it is
apps/server @beonauto/server Node HTTP server: GET /health, graceful shutdown on SIGTERM
apps/cloudflare @beonauto/cloudflare Worker + Durable Object that fronts the server container (@cloudflare/containers)
packages/config @beonauto/config Reads HOST/PORT from the environment

Toolchain

  • Node 26.10, running .ts directly (native type stripping). No build step for the server or internal packages; workspace packages export src/index.ts.
  • TypeScript 7.0.2 for type-checking: strict, plus noUncheckedIndexedAccess, exactOptionalPropertyTypes and erasableSyntaxOnly.
  • Oxlint 1.86 with type-aware rules. Covers every rule from the old ESLint config, and adds:
    • no as assertions or any
    • no disable directives
    • no coverage-ignore comments
  • Oxfmt for formatting.
  • Vitest 5, with 100% coverage enforced per file. Tests run on Node's native loader, so they execute exactly what production runs. main.ts is covered by spawning the real process.
  • Turborepo 2.11 for caching. A transit-node task makes a dependency's source change re-run its dependents' lint, type-check and tests. This is verified by hash comparison.
  • pnpm 12, with catalogs, a 24-hour minimum release age, trustPolicy: no-downgrade, and an explicit allowBuilds list.
  • Guardrails:
    • lefthook runs Oxfmt and Oxlint on staged files, commitlint on commit messages, and the affected gate on push.
    • Commit scopes come from workspace names; czg provides the guided prompt (pnpm commit).
    • knip and sherif check for unused code and dependency consistency.

Container

  • One Dockerfile, multi-arch (amd64 + arm64). It runs as the non-root node user, contains no test files, and is 249 MB.
  • Dependencies resolve in a build-platform stage, so the arm64 build needs no emulation.
  • It exits 0 on SIGTERM, which is how Cloudflare stops instances.

CI/CD

  • ci.yml runs on PRs, the merge queue and main. It contains:

    • pnpm check
    • a container build plus smoke test
    • a commitlint check on the PR title
    • a zizmor audit of the workflow files

    All of these sit behind one required check, ci-ok. Every action is pinned by SHA, and the repo now enforces that.

  • release.yml: release-please maintains a release PR using a short-lived BeOnAutoBot token. Merging it tags vX.Y.Z and then:

    • publishes the multi-arch image to ghcr.io/beonauto/auto-brain, with provenance and an SBOM, and also to Docker Hub once it is configured;
    • copies the amd64 manifest byte for byte into Cloudflare's registry. Cloudflare can't pull from GHCR;
    • deploys the Worker pinned to that digest.

    Both the Docker Hub and the Cloudflare steps stay off until their credentials exist.

  • Renovate handles dependency updates, grouped for non-major bumps and held back by a one-day minimum release age.

Verified locally

  • pnpm check: all 13 tasks green, about 0.5 s cold.
  • docker build plus a smoke test: health returns 200, the process runs as node, and it exits 0 on stop.
  • wrangler deploy --dry-run builds the Worker bundle and the image.
  • zizmor reports no findings.
  • Save-to-signal timings:
    • pnpm dev reload: 288 ms
    • root Vitest run: 191 ms
    • TypeScript 7 full type-check: 0.6 s

🤖 Generated with Claude Code

SamHatoum and others added 6 commits September 29, 2026 16:44
Clear the repository for the auto-brain rebuild. The plugin's final state is
preserved in BeOnAuto/auto-agent-backup at e50f420.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rborepo toolchain

Node 26 runs TypeScript directly, so nothing is built before it runs.
Oxlint enforces the strict type-aware rules, Oxfmt formats, Vitest holds
every file to 100% coverage, and Turborepo caches the gate with transit
nodes so a dependency's source change re-runs its dependents. Lefthook
formats and lints staged files, checks commit messages, and runs the
affected gate before a push.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Package it as one container image for Cloudflare Containers and on-prem:
multi-arch, non-root, dependencies resolved on the build platform so the
runtime stage needs no emulation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e image and deploy

CI runs the full gate, smoke-tests the container, lints the pull request
title and audits the workflows with zizmor, all behind one required ci-ok
check. Releases publish the image to GHCR (and Docker Hub once
configured), then copy its amd64 manifest into the Cloudflare registry and
deploy the Worker pinned to that digest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SamHatoum
SamHatoum added this pull request to the merge queue Sep 30, 2026
Merged via the queue into main with commit 405d04b Sep 30, 2026
5 checks passed
@SamHatoum
SamHatoum deleted the iteration-zero branch September 30, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant