From e1b3cd5634729bd9df30f3af9006aca0e15c783d Mon Sep 17 00:00:00 2001 From: ReachableCEO Date: Wed, 17 Sep 2025 11:08:45 -0500 Subject: [PATCH] scaffold: add project CI and Docker templates under templates/project/_shared; update proposal and plan to include them --- collab/plan/01-codexhelper.md | 5 +++-- collab/proposals/01-codexhelper.llm.md | 2 ++ collab/proposals/01-codexhelper.md | 7 ++++--- docs/devlog/DEVLOG_LLM.md | 8 ++++++++ .../project/_shared/.gitea/workflows/ci.yml | 17 +++++++++++++++++ templates/project/_shared/docker/compose.yml | 19 +++++++++++++++++++ .../project/_shared/docker/test/Dockerfile | 11 +++++++++++ .../project/_shared/scripts/test.docker.sh | 12 ++++++++++++ 8 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 templates/project/_shared/.gitea/workflows/ci.yml create mode 100644 templates/project/_shared/docker/compose.yml create mode 100644 templates/project/_shared/docker/test/Dockerfile create mode 100644 templates/project/_shared/scripts/test.docker.sh diff --git a/collab/plan/01-codexhelper.md b/collab/plan/01-codexhelper.md index 7353108..adcad76 100644 --- a/collab/plan/01-codexhelper.md +++ b/collab/plan/01-codexhelper.md @@ -24,7 +24,7 @@ Purpose: Deliver Phase 1 (Crawl) MVP of CodexHelper: subcommands, scaffolding, p - Implement creation with intake comments and overwrite safeguards. 4) new-project (outside repo) (tests first) -- Write tests for project directory creation, copying AGENTS.md, prompts, codex.yaml, codex.sh, and `.gitignore` content. +- Write tests for project directory creation, copying AGENTS.md, prompts, codex.yaml, codex.sh, `.gitignore` content, and CI/containers artifacts (`.gitea/workflows/ci.yml`, `docker/compose.yml`, `docker/test/Dockerfile`, `scripts/test.docker.sh`). - Implement scaffolding and read-only copies under `prompts/_mode/`. 5) run: compose + invoke (tests first) @@ -57,7 +57,8 @@ Purpose: Deliver Phase 1 (Crawl) MVP of CodexHelper: subcommands, scaffolding, p - Precedence: CLI > env > project > mode > global. - `prompts/global/{system.md,system.llm.md}` are present and included in composition. - Running `CodexHelper run` or `new-project` inside this repo errors with guidance. - - Tests: bats test suite covers all CLI paths and guardrails; tests pass locally; test runner script present. +- Tests: bats test suite covers all CLI paths and guardrails; tests pass locally; test runner script present. + - Project CI: scaffold contains Gitea workflow and Docker artifacts for local parity. ## Assumptions/Risks - codex-cli flags may vary; we’ll design pass-through and document tested flags. diff --git a/collab/proposals/01-codexhelper.llm.md b/collab/proposals/01-codexhelper.llm.md index fbc7d0c..b9fd3d5 100644 --- a/collab/proposals/01-codexhelper.llm.md +++ b/collab/proposals/01-codexhelper.llm.md @@ -32,6 +32,8 @@ - planning: architecture/module map documented; module implementations follow approved plan with no unplanned refactors - clean root: root remains minimal; scaffolding organizes assets under subdirectories - ci/containers: Gitea Actions and local Docker Compose run identical workflows; explicit names and cleanup verified + - project CI: scaffold includes `.gitea/workflows/ci.yml`, `docker/compose.yml`, `docker/test/Dockerfile`, and `scripts/test.docker.sh` + - ci/containers: Gitea Actions and local Docker Compose run identical workflows; explicit names and cleanup verified \n+## Approval — Tick All That Apply - Subcommands approved: `new-project`, `run`, `new-mode` [ ] diff --git a/collab/proposals/01-codexhelper.md b/collab/proposals/01-codexhelper.md index e1beb42..98189f5 100644 --- a/collab/proposals/01-codexhelper.md +++ b/collab/proposals/01-codexhelper.md @@ -52,7 +52,7 @@ Purpose: Implement a bash wrapper (CodexHelper) around codex-cli with “modes - `codex.yaml` (project config) - `codex.sh` (entrypoint wrapper around codex-cli) - `runs/` (created on first run; ignored by VCS) - - `.gitea/workflows/` for CI; `docker/` for compose and Dockerfiles; `scripts/` for docker orchestration (tests, ci) +- `.gitea/workflows/` for CI; `docker/` for compose and Dockerfiles; `scripts/` for docker orchestration (tests, ci) ## Config Details - Format: YAML (`yq` for merging/reading) @@ -102,13 +102,14 @@ Purpose: Implement a bash wrapper (CodexHelper) around codex-cli with “modes - Inside that project, `CodexHelper run --full-auto` composes prompts and calls the detected `codex` binary. It writes artifacts under `runs//...`. - Precedence works: CLI options override env, which override project config, which override mode defaults. - Running `CodexHelper run` in this repo prints an error guiding usage. - - Project scaffold includes `AGENTS.md` copied from `templates/project/_shared/AGENTS.md`. +- Project scaffold includes `AGENTS.md` copied from `templates/project/_shared/AGENTS.md`. - `prompts/global/{system.md, system.llm.md}` exist and are included in composition. - Governance/Propagation honored: when norms change, update `prompts/global/` and AGENTS templates; log in DevLog. - TDD honored: a test suite (bats) covers CLI flows and guardrails; tests pass. - Zero Debt honored: code, tests, and docs complete; no debt items remain. - Clean Root honored: only essential files at root; scaffolding places assets under subdirectories. - - CI/Containers honored: CI runs in Gitea and locally using the same Docker Compose; containers and networks use explicit names and are cleaned up. +- CI/Containers honored: CI runs in Gitea and locally using the same Docker Compose; containers and networks use explicit names and are cleaned up. + - Project scaffold includes `.gitea/workflows/ci.yml`, `docker/compose.yml`, `docker/test/Dockerfile`, and `scripts/test.docker.sh` copied from templates. ## Open Items for Confirmation - Template coverage: include `prompts/style.md` by default? (we’ll include as optional, empty file) diff --git a/docs/devlog/DEVLOG_LLM.md b/docs/devlog/DEVLOG_LLM.md index 65031f1..f0b5f05 100644 --- a/docs/devlog/DEVLOG_LLM.md +++ b/docs/devlog/DEVLOG_LLM.md @@ -181,3 +181,11 @@ This log is concise and structured for quick machine parsing and summarization. - Propagated CI/containers rules to system prompts and AGENTS templates; updated proposal - next: - Ensure future features include containerized workflows and CI updates + +## 2025-09-17T17:00Z +- context: Project scaffolding to include Gitea workflow and Docker artifacts +- actions: + - Added project templates: `.gitea/workflows/ci.yml`, `docker/compose.yml`, `docker/test/Dockerfile`, `scripts/test.docker.sh` + - Updated proposal and plan to require these in generated projects +- next: + - Implement new-project scaffolder to copy these templates diff --git a/templates/project/_shared/.gitea/workflows/ci.yml b/templates/project/_shared/.gitea/workflows/ci.yml new file mode 100644 index 0000000..eb8491d --- /dev/null +++ b/templates/project/_shared/.gitea/workflows/ci.yml @@ -0,0 +1,17 @@ +name: ci + +on: + push: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Build and run tests via Docker + run: | + docker compose -f docker/compose.yml up --build --abort-on-container-exit --remove-orphans + docker compose -f docker/compose.yml down -v --remove-orphans + diff --git a/templates/project/_shared/docker/compose.yml b/templates/project/_shared/docker/compose.yml new file mode 100644 index 0000000..2393cbc --- /dev/null +++ b/templates/project/_shared/docker/compose.yml @@ -0,0 +1,19 @@ +name: project + +services: + tests: + build: + context: .. + dockerfile: docker/test/Dockerfile + container_name: project-tests + working_dir: /work + volumes: + - ..:/work:Z + command: ["/bin/bash", "-lc", "scripts/test.sh"] + networks: + - project-net + +networks: + project-net: + name: project-net + diff --git a/templates/project/_shared/docker/test/Dockerfile b/templates/project/_shared/docker/test/Dockerfile new file mode 100644 index 0000000..d3330ed --- /dev/null +++ b/templates/project/_shared/docker/test/Dockerfile @@ -0,0 +1,11 @@ +FROM debian:bookworm-slim + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + ca-certificates git bash curl jq yq \ + bats \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /work + diff --git a/templates/project/_shared/scripts/test.docker.sh b/templates/project/_shared/scripts/test.docker.sh new file mode 100644 index 0000000..4f719a5 --- /dev/null +++ b/templates/project/_shared/scripts/test.docker.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +here="$(cd "$(dirname "$0")" && pwd)" +root="$(cd "$here/.." && pwd)" + +compose_file="$root/docker/compose.yml" + +echo "[docker] Running tests via docker compose" +docker compose -f "$compose_file" up --build --abort-on-container-exit --remove-orphans +docker compose -f "$compose_file" down -v --remove-orphans +