@@ -4,61 +4,84 @@ Guidance for AI coding agents (OpenAI Codex and similar) working in the **OpenBl
44
55## What this repo is
66
7- OpenBlog is a personal blog project. The repository is currently an early
8- scaffold — at the time of writing it contains only a ` README.md ` and a starter
9- GitHub Actions workflow (` .github/workflows/blank.yml ` ). There is ** no
10- application code, build system, or test suite yet** . Treat the structure below
11- as the intended target; create files as needed when implementing a task.
7+ OpenBlog is a personal blog system positioned as an ** AI-driven, auto-generate &
8+ auto-publish blog** : daily thoughts become your memory, daily posts become your
9+ IP. See [ README.md] ( README.md ) for the full positioning.
10+
11+ The repo now ships a working ** static-site generator** : Markdown posts in
12+ ` posts/ ` are rendered to a static site in ` public/ ` and published to GitHub
13+ Pages by CI.
1214
1315## Repository layout
1416
1517```
1618.
1719├── AGENTS.md # this file
18- ├── README.md
20+ ├── README.md # positioning + usage
21+ ├── package.json # scripts: build, serve
22+ ├── posts/ # Markdown articles (the content source)
23+ │ └── *.md # front matter: title, date, tags, summary
24+ ├── scripts/
25+ │ └── build.mjs # static-site generator (Markdown -> public/)
26+ ├── public/ # build output (git-ignored, regenerated)
1927└── .github/
2028 └── workflows/
21- └── blank .yml # placeholder CI (echoes hello world)
29+ └── publish .yml # scheduled generate + publish to Pages
2230```
2331
24- When you add real code, prefer a conventional static-site / blog layout
25- (e.g. ` src/ ` , ` content/ ` or ` posts/ ` for Markdown articles, ` public/ ` or
26- ` dist/ ` for build output). Document any structure you introduce back in this
27- file and the ` README.md ` .
28-
29- ## Branches
32+ ## Branch policy — IMPORTANT
3033
31- - ` main ` — default / production branch.
32- - ` develop ` — integration branch.
34+ - ** ` develop ` ** — integration branch. ** This is the default branch for all work
35+ and pushes.** Commit here and ` git push origin develop ` .
36+ - ** ` main ` ** — production / published branch. The publish workflow deploys from
37+ ` main ` . Only merge ` develop -> main ` when explicitly releasing/publishing.
3338
34- Open pull requests against ` main ` unless the task says otherwise. Never force-push
35- shared branches.
39+ ** Default to ` develop ` . ** Do NOT push or open PRs against ` main ` unless the task
40+ explicitly says to release/publish. Never force-push shared branches.
3641
3742## Build, run, and test
3843
39- There is no build or test tooling configured yet. ** Do not invent commands that
40- do not exist.** If a task requires building or testing:
44+ Toolchain: Node.js (ESM), deps ` marked ` + ` gray-matter ` .
45+
46+ ``` bash
47+ npm ci # install (CI) — or npm install locally
48+ npm run build # render posts/ -> public/
49+ npm run serve # build, then serve public/ at http://localhost:8080
50+ ```
51+
52+ Validation for a change: ` npm run build ` succeeds and produces
53+ ` public/index.html ` plus one ` public/posts/<slug>.html ` per post. Verify the
54+ build runs before claiming it works.
4155
42- 1 . Choose a stack appropriate to a blog (e.g. a static-site generator), add its
43- manifest (` package.json ` , etc.), and wire real ` build ` /` test ` scripts.
44- 2 . Update this section and the CI workflow with the actual commands you added.
45- 3 . Verify commands run locally before claiming they work.
56+ ## Authoring posts
57+
58+ Add a ` .md ` file under ` posts/ ` (filename becomes the URL slug). Front matter:
59+
60+ ``` markdown
61+ ---
62+ title: My thought
63+ date: 2026-06-11
64+ tags: [ memory, ai]
65+ summary: One-line teaser shown on the index.
66+ ---
67+
68+ # My thought
69+ ...
70+ ```
4671
47- Until then, validation means: the repo still clones, Markdown/HTML renders, and
48- the CI workflow stays green .
72+ All fields are optional — missing title falls back to the first heading or the
73+ filename; missing date falls back to file mtime .
4974
5075## Conventions
5176
5277- Keep changes focused and minimal; match the style of surrounding files.
53- - Blog content should be authored in Markdown.
54- - Commit messages: short imperative subject line; explain the "why" in the body
55- when non-obvious.
56- - Do not commit secrets, build artifacts, or large binaries.
78+ - Blog content is authored in Markdown.
79+ - Don't commit ` node_modules/ ` or ` public/ ` (both git-ignored).
80+ - Commit messages: short imperative subject; explain the "why" when non-obvious.
5781
5882## For the Codex cloud agent
5983
60- - Read this file first to understand scope before making changes.
61- - An optional environment setup script lives at ` .codex/setup.sh ` — run it to
62- prepare a working environment. It is a no-op until a real toolchain is added.
63- - Make the smallest change that satisfies the task, open a PR against ` main ` ,
64- and describe what you did and how you verified it.
84+ - Read this file first; respect the ** develop-default** branch policy above.
85+ - Environment setup script: [ .codex/setup.sh] ( .codex/setup.sh ) (runs ` npm ci ` ).
86+ - Make the smallest change that satisfies the task, push to ` develop ` , and
87+ describe what you did and how you verified it (` npm run build ` ).
0 commit comments