Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions .codex/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,10 @@ set -euo pipefail

echo "[codex-setup] OpenBlog: preparing environment"

# --- Node.js / static-site generator (uncomment once a package.json exists) ---
# if [ -f package.json ]; then
# echo "[codex-setup] installing npm dependencies"
# npm ci || npm install
# fi
# --- Node.js / static-site generator ------------------------------------------
if [ -f package.json ]; then
echo "[codex-setup] installing npm dependencies"
npm ci || npm install
fi

# --- Python (uncomment if a Python-based generator is used) -------------------
# if [ -f requirements.txt ]; then
# echo "[codex-setup] installing pip dependencies"
# pip install -r requirements.txt
# fi

echo "[codex-setup] done (no toolchain configured yet)"
echo "[codex-setup] done"
36 changes: 0 additions & 36 deletions .github/workflows/blank.yml

This file was deleted.

62 changes: 62 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Generate & Publish

# Builds the static site from posts/ and publishes it to GitHub Pages.
#
# Triggers:
# - daily on a schedule (so AI-generated posts go live automatically)
# - on push to main (the production branch)
# - manually via the Actions tab
#
# Note: develop is the integration branch; publishing happens from main.
# Merge develop -> main to release.

on:
schedule:
# 23:17 UTC daily (~07:17 Asia/Shanghai). Off the :00 mark on purpose.
- cron: "17 23 * * *"
push:
branches: ["main"]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment.
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Build site
run: npm run build

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: public

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Dependencies
node_modules/

# Build output (regenerated by scripts/build.mjs)
public/

# Logs / OS cruft
*.log
.DS_Store
91 changes: 57 additions & 34 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,61 +4,84 @@ Guidance for AI coding agents (OpenAI Codex and similar) working in the **OpenBl

## What this repo is

OpenBlog is a personal blog project. The repository is currently an early
scaffold — at the time of writing it contains only a `README.md` and a starter
GitHub Actions workflow (`.github/workflows/blank.yml`). There is **no
application code, build system, or test suite yet**. Treat the structure below
as the intended target; create files as needed when implementing a task.
OpenBlog is a personal blog system positioned as an **AI-driven, auto-generate &
auto-publish blog**: daily thoughts become your memory, daily posts become your
IP. See [README.md](README.md) for the full positioning.

The repo now ships a working **static-site generator**: Markdown posts in
`posts/` are rendered to a static site in `public/` and published to GitHub
Pages by CI.

## Repository layout

```
.
├── AGENTS.md # this file
├── README.md
├── README.md # positioning + usage
├── package.json # scripts: build, serve
├── posts/ # Markdown articles (the content source)
│ └── *.md # front matter: title, date, tags, summary
├── scripts/
│ └── build.mjs # static-site generator (Markdown -> public/)
├── public/ # build output (git-ignored, regenerated)
└── .github/
└── workflows/
└── blank.yml # placeholder CI (echoes hello world)
└── publish.yml # scheduled generate + publish to Pages
```
Comment on lines 15 to 30

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Missing language specifier on fenced code block.

The fenced code block at line 17 should specify a language for proper syntax highlighting and linting compliance.

📝 Proposed fix
 ## Repository layout
 
-```
+```plaintext
 .
 ├── AGENTS.md                  # this file
 ├── README.md                  # positioning + usage
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## Repository layout
```
.
├── AGENTS.md # this file
├── README.md
├── README.md # positioning + usage
├── package.json # scripts: build, serve
├── posts/ # Markdown articles (the content source)
│ └── *.md # front matter: title, date, tags, summary
├── scripts/
│ └── build.mjs # static-site generator (Markdown -> public/)
├── public/ # build output (git-ignored, regenerated)
└── .github/
└── workflows/
└── blank.yml # placeholder CI (echoes hello world)
└── publish.yml # scheduled generate + publish to Pages
```
## Repository layout
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 17-17: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@AGENTS.md` around lines 15 - 30, The fenced code block in AGENTS.md showing
the repository layout lacks a language specifier; update the opening fence to
include a language (e.g., change ``` to ```plaintext or ```text) so the block
becomes "```plaintext" and leave the closing fence intact; this ensures proper
syntax highlighting and linting compliance for the repository layout block.


When you add real code, prefer a conventional static-site / blog layout
(e.g. `src/`, `content/` or `posts/` for Markdown articles, `public/` or
`dist/` for build output). Document any structure you introduce back in this
file and the `README.md`.

## Branches
## Branch policy — IMPORTANT

- `main` — default / production branch.
- `develop` — integration branch.
- **`develop`** — integration branch. **This is the default branch for all work
and pushes.** Commit here and `git push origin develop`.
- **`main`** — production / published branch. The publish workflow deploys from
`main`. Only merge `develop -> main` when explicitly releasing/publishing.

Open pull requests against `main` unless the task says otherwise. Never force-push
shared branches.
**Default to `develop`.** Do NOT push or open PRs against `main` unless the task
explicitly says to release/publish. Never force-push shared branches.

## Build, run, and test

There is no build or test tooling configured yet. **Do not invent commands that
do not exist.** If a task requires building or testing:
Toolchain: Node.js (ESM), deps `marked` + `gray-matter`.

```bash
npm ci # install (CI) — or npm install locally
npm run build # render posts/ -> public/
npm run serve # build, then serve public/ at http://localhost:8080
```

Validation for a change: `npm run build` succeeds and produces
`public/index.html` plus one `public/posts/<slug>.html` per post. Verify the
build runs before claiming it works.

1. Choose a stack appropriate to a blog (e.g. a static-site generator), add its
manifest (`package.json`, etc.), and wire real `build`/`test` scripts.
2. Update this section and the CI workflow with the actual commands you added.
3. Verify commands run locally before claiming they work.
## Authoring posts

Add a `.md` file under `posts/` (filename becomes the URL slug). Front matter:

```markdown
---
title: My thought
date: 2026-06-11
tags: [memory, ai]
summary: One-line teaser shown on the index.
---

# My thought
...
```

Until then, validation means: the repo still clones, Markdown/HTML renders, and
the CI workflow stays green.
All fields are optional — missing title falls back to the first heading or the
filename; missing date falls back to file mtime.

## Conventions

- Keep changes focused and minimal; match the style of surrounding files.
- Blog content should be authored in Markdown.
- Commit messages: short imperative subject line; explain the "why" in the body
when non-obvious.
- Do not commit secrets, build artifacts, or large binaries.
- Blog content is authored in Markdown.
- Don't commit `node_modules/` or `public/` (both git-ignored).
- Commit messages: short imperative subject; explain the "why" when non-obvious.

## For the Codex cloud agent

- Read this file first to understand scope before making changes.
- An optional environment setup script lives at `.codex/setup.sh` — run it to
prepare a working environment. It is a no-op until a real toolchain is added.
- Make the smallest change that satisfies the task, open a PR against `main`,
and describe what you did and how you verified it.
- Read this file first; respect the **develop-default** branch policy above.
- Environment setup script: [.codex/setup.sh](.codex/setup.sh) (runs `npm ci`).
- Make the smallest change that satisfies the task, push to `develop`, and
describe what you did and how you verified it (`npm run build`).
46 changes: 39 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,27 +60,59 @@ OpenBlog 用 AI Agent 把这条链路自动化:

## 项目状态

> ⚠️ **早期阶段(Scaffold)**
> 🚧 **早期可用(Early / MVP)**
>
> 当前仓库处于初始搭建阶段,尚未包含完整的应用代码与生成/发布流水线。
> 上面描述的是项目的**目标定位与设计蓝图**,功能正在逐步落地。
> 已具备一条可运行的静态站点流水线:`posts/` 里的 Markdown 文章会被生成器渲染成站点,并由 CI 定时构建、自动发布到 GitHub Pages。AI 自动撰写文章的环节正在逐步接入。

### 路线图(Roadmap)

- [x] 静态站点生成器(Markdown → HTML)
- [x] 自动构建与发布(GitHub Pages,定时 + 触发)
- [ ] 记忆采集与结构化存储
- [ ] AI 文章生成流水线
- [ ] 自动构建与发布
- [ ] 定时 / 触发式自动运行
- [ ] AI 文章生成流水线(由记忆自动撰写)
- [ ] 站点主题与个人化配置

## 快速开始

```bash
git clone https://github.com/xiami303/OpenBlog.git
cd OpenBlog
npm install # 安装依赖
npm run build # 渲染 posts/ → public/
npm run serve # 构建并本地预览 http://localhost:8080
```

> 构建与运行命令将随功能落地补充。当前仓库尚无构建工具链 —— 详见 [AGENTS.md](AGENTS.md)。
### 写一篇文章

在 `posts/` 下新建一个 `.md` 文件(文件名即文章 URL slug),开头写好 front matter:

```markdown
---
title: 我的想法
date: 2026-06-11
tags: [memory, ai]
summary: 显示在首页的一句话简介。
---

# 我的想法
...
```

所有字段都可省略 —— 没有 title 就用第一个标题或文件名,没有 date 就用文件修改时间。运行 `npm run build` 后,文章就会出现在站点上。

## 目录结构

```
posts/ # Markdown 文章(内容源)
scripts/build.mjs # 静态站点生成器
public/ # 构建产物(自动生成,已 gitignore)
.github/workflows/ # 定时生成 + 自动发布到 Pages
```
Comment on lines +103 to +110

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Missing language specifier on fenced code block.

The fenced code block at line 105 should specify a language for proper syntax highlighting and linting compliance.

📝 Proposed fix
-```
+```plaintext
 posts/                # Markdown 文章(内容源)
 scripts/build.mjs     # 静态站点生成器
 public/               # 构建产物(自动生成,已 gitignore)
 .github/workflows/    # 定时生成 + 自动发布到 Pages
</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion
## 目录结构

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 105-105: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 103 - 110, The fenced code block in README.md
containing the directory listing (lines with "posts/", "scripts/build.mjs",
"public/", ".github/workflows/") lacks a language specifier; update the opening
fence from ``` to include a language like plaintext or text (e.g., ```plaintext)
so the block is properly highlighted and passes linting.


## 分支规则

- **`develop`** —— 集成分支,**日常开发与提交的默认分支**。
- **`main`** —— 生产 / 已发布分支,CI 从这里部署到 Pages。仅在发布时把 `develop` 合并到 `main`。

## 参与开发

Expand Down
Loading