Skip to content

Commit cbdccec

Browse files
committed
refactor: fix make shell and cleanup Makefile
1 parent 738d56c commit cbdccec

6 files changed

Lines changed: 35 additions & 49 deletions

File tree

.agent/working-memory/session.md

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,25 @@
11
# Working Memory
22

3-
## Active tasks
3+
## Active task
44

5-
- Task: Plan for dynamically embedding awesome-modeling-practices README into a Hugo page
6-
- Current status: Plan written (see .agent/working-memory/plan-awesome-list.md)
7-
- Open questions: None at this stage; ready to implement on request
8-
- Next actions: Implement plan steps on user approval
5+
- awesome-modeling-practices embed plan is ready: `.agent/working-memory/plan-awesome-list.md`.
6+
- Next step on request: implement the planned integration.
97

10-
## Deployment context (updated 2026-03-28)
8+
## Notes by date (newest first)
119

12-
- Workflow: `.github/workflows/gh-pages.yml`
13-
- Trigger: push to `develop` branch
14-
- Build: containerized via Docker Compose (`docker compose build hugo` + `docker compose run hugo hugo build --gc --minify`), mirroring local deployment toolchain and image
15-
- Deploy method: `actions/upload-pages-artifact` + `actions/deploy-pages` (OIDC, no branch write)
16-
- **No `main` branch is used for deployment.** The old `peaceiris/actions-gh-pages` approach that pushed to `main` has been replaced. The `main` branch is obsolete.
17-
- Required repo setting: Settings → Pages → Source must be **GitHub Actions** (not "Deploy from a branch").
10+
### 2026-03-31
1811

19-
## CI troubleshooting (updated 2026-03-29)
12+
- `Makefile` maintenance completed: fixed `make shell`, refactored shared Docker Compose flags, removed global `.NOTPARALLEL`, and simplified `clean` with a merged `find`.
13+
- Validation: `make -n` checks passed for `build`, `serve`, `render`, `shell`, `stop`, and `clean`.
2014

21-
- Hugo module/cache paths inside the container must resolve to absolute directories for the current CI image/version.
22-
- For Docker Compose workflows, use separate variables for host and container cache paths:
23-
- host path for GitHub Actions cache: `./.hugo_cache`
24-
- container path for Hugo `--cacheDir`: `/src/.hugo_cache`
25-
- Running the container as `--user "$(id -u):$(id -g)"` avoids root-owned workspace files, but it also means default cache locations like `/cache/modules` may be unwritable.
15+
### 2026-03-29
2616

27-
## Shared build entrypoint planning (updated 2026-03-29)
17+
- CI/cache troubleshooting: keep host cache at `./.hugo_cache` and container cache at `/src/.hugo_cache`; `--user "$(id -u):$(id -g)"` avoids root-owned files.
18+
- Shared build entrypoint plan: `.agent/working-memory/plan-shared-build-entrypoint.md`.
19+
- Checkpoint: `.agent/checkpoints/checkpoint-20260329-0824.md`.
2820

29-
- Plan created: `.agent/working-memory/plan-shared-build-entrypoint.md`
30-
- Objective: route local production render, htmltest render, and GitHub Pages build through one repository-owned build script.
31-
- Preferred shape: keep workflow orchestration in YAML, move only the canonical Hugo build logic into a shared container-executed shell script.
21+
### 2026-03-28
3222

33-
## Checkpoint and docs sync (updated 2026-03-29)
34-
35-
- Checkpoint added: `.agent/checkpoints/checkpoint-20260329-0824.md`.
36-
- Contributor docs synced: `README.md` now documents shared build entrypoint and `make render`.
37-
- Agent docs synced: `AGENTS.md` now references `.github/scripts/build-site.sh` and local production-style render guidance.
38-
- Repo hygiene: `.gitignore` now ignores generated `/.hugo_cache/` and `/dist/` build outputs.
23+
- Deployment workflow: `.github/workflows/gh-pages.yml` on `develop`.
24+
- Build/deploy path: Docker Compose `hugo` service + `.github/scripts/build-site.sh`, then `actions/upload-pages-artifact` and `actions/deploy-pages`.
25+
- Pages source requirement: GitHub Actions (not branch deployment); no `main` branch publishing.

.github/copilot-instructions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ This file is intentionally minimal.
55
The canonical agent policy for this repository is in `AGENTS.md`.
66

77
Read and follow `AGENTS.md` first, then use this file only for Copilot-specific addenda (if any).
8+
9+
If guidance here differs from `AGENTS.md`, `AGENTS.md` takes precedence.

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ For a contributor-facing overview, see the Agent Harness section in [README.md](
1010

1111
- This file defines the shared operating contract for all AI agents.
1212
- If guidance in `.github/copilot-instructions.md` or `CLAUDE.md` differs, follow this file.
13+
- `README.md` provides contributor-facing context; this file remains authoritative for agent behavior.
1314
- Agent-specific files should provide adapter notes only and link back here.
1415

1516
## Agent harness
@@ -30,7 +31,7 @@ Agent-generated artifacts must be written under `.agent/`.
3031
## Command execution environment
3132

3233
- Run project commands in containers only; do not assume local `go`, `hugo`, `node`, or `npm` are installed on the host.
33-
- Use Docker Compose with the `hugo` service for build/test/update tasks (for example: `docker compose run --rm hugo <command>`).
34+
- Use Docker Compose with the `hugo` service for build/test/update tasks (for example: `docker compose run --rm --no-deps --entrypoint sh hugo -c '<command>'`).
3435
- Prefer the shared Hugo production build entrypoint `.github/scripts/build-site.sh` for render operations used by CI and local production-style checks.
3536
- Use `make render` for the local production-style render path and `make serve` for local hot-reload preview.
3637
- If a command cannot run in the current container setup, document the limitation and propose a container-based alternative.

CLAUDE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ This file is intentionally minimal.
55
The canonical agent policy for this repository is in `AGENTS.md`.
66

77
Read and follow `AGENTS.md` first, then use this file only for Claude-specific addenda (if any).
8+
9+
If guidance here differs from `AGENTS.md`, `AGENTS.md` takes precedence.

Makefile

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,40 @@
66
MAKEFILES=Makefile $(wildcard *.mk)
77
UID=$(shell id -u)
88
GID=$(shell id -g)
9+
DOCKER_COMPOSE=docker compose
10+
HUGO_RUN_SH=$(DOCKER_COMPOSE) run --rm --no-deps --entrypoint sh
11+
HUGO_USER_ENV=--user "$(UID):$(GID)" -e HOME=/tmp -e npm_config_cache=/tmp/.npm -e HUGO_CACHEDIR=/src/.hugo_cache
912

1013
# Controls
11-
.PHONY : commands clean stop serve render
12-
.NOTPARALLEL:
14+
.PHONY : all commands build clean stop serve render shell
1315
all : commands
1416

1517
## commands : show all commands.
1618
commands :
1719
@grep -h -E '^##' ${MAKEFILES} | sed -e 's/## //g'
1820

1921
## build : build files but do not run a server.
20-
build :
21-
docker compose build --pull
22+
build :
23+
$(DOCKER_COMPOSE) build --pull
2224

2325
## serve : start and run a local server.
2426
serve : build
25-
@docker compose up -d
27+
@$(DOCKER_COMPOSE) up -d
2628

2729
## render : run the production-style site render locally.
2830
render : build
29-
docker compose run --rm --no-deps \
30-
--entrypoint sh \
31-
hugo -c 'rm -f /src/.hugo_build.lock && rm -rf /src/public /src/resources/_gen'
32-
docker compose run --rm --no-deps \
33-
--entrypoint sh \
34-
--user "$(UID):$(GID)" \
35-
-e HOME=/tmp \
36-
-e npm_config_cache=/tmp/.npm \
37-
-e HUGO_CACHEDIR=/src/.hugo_cache \
38-
hugo -c '.github/scripts/build-site.sh'
31+
$(HUGO_RUN_SH) hugo -c 'rm -f /src/.hugo_build.lock && rm -rf /src/public /src/resources/_gen'
32+
$(HUGO_RUN_SH) $(HUGO_USER_ENV) hugo -c '.github/scripts/build-site.sh'
3933

4034
## shell : open a hugo shell
4135
shell : build
42-
docker compose run --rm hugo shell
36+
$(HUGO_RUN_SH) $(HUGO_USER_ENV) hugo
4337

4438
## stop : stop the docker server and clean up
4539
stop :
46-
docker compose down -v
40+
$(DOCKER_COMPOSE) down -v
4741

4842
## clean : clean up junk files.
4943
clean :
5044
@rm -rf ./resources/_gen
51-
@find . -name .DS_Store -print -exec rm {} \;
52-
@find . -name '*~' -print -exec rm {} \;
45+
@find . \( -name .DS_Store -o -name '*~' \) -print -exec rm {} +

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This repository includes an agent collaboration harness for AI-assisted work.
1212

1313
- Canonical policy: `AGENTS.md` is the source of truth for agent behavior.
1414
- Agent notes: `.github/copilot-instructions.md` and `CLAUDE.md` are adapter files that defer to `AGENTS.md`.
15+
- Command environment for agents: run project commands in containers via Docker Compose (`hugo` service).
1516
- Agent artifacts: `.agent/` stores generated working context and transfer records.
1617
- `.agent/working-memory/` for in-progress notes
1718
- `.agent/checkpoints/` for progress snapshots
@@ -25,7 +26,7 @@ The site is deployed to GitHub Pages via the workflow at `.github/workflows/gh-p
2526

2627
### How it works
2728

28-
1. The `build` job checks out `develop`, configures the Pages base URL, then builds the site inside the same Docker Compose `hugo` service used for local development (`docker compose build hugo` + `docker compose run hugo ...`). The Hugo invocation itself is centralized in `.github/scripts/build-site.sh`, which is shared across local production-style rendering and CI workflows.
29+
1. The `build` job checks out `develop`, configures the Pages base URL, then builds the site inside the same Docker Compose `hugo` service used for local development (`docker compose build --pull hugo` + `docker compose run --rm --no-deps --entrypoint sh hugo -c ...`). The Hugo invocation itself is centralized in `.github/scripts/build-site.sh`, which is shared across local production-style rendering and CI workflows.
2930
2. The `deploy` job receives that artifact and publishes it directly to GitHub Pages via GitHub's OIDC-based Pages API (`actions/deploy-pages`).
3031

3132
**No "built" branch is used.** The old approach pushed compiled HTML to a `main` branch using `peaceiris/actions-gh-pages`. That is no longer the case — the deployment artifact goes straight to GitHub's Pages infrastructure. The `main` branch (if it still exists in the remote) is a leftover and is no longer updated.

0 commit comments

Comments
 (0)