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
10 changes: 10 additions & 0 deletions .github/workflows/git-policy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ jobs:
else
node scripts/check-commit-message.mjs "$PR_TITLE"
fi
- name: Check release changelog
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
if [ "$BASE_REF" = "main" ]; then
node scripts/check-release-changelog.mjs origin/main "$HEAD_SHA"
else
echo "Not a release PR; changelog gate skipped."
fi
- name: Check template cleanliness
run: cd code && npm run book:release-check

Expand Down
11 changes: 8 additions & 3 deletions ADOPT.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## What you are installing

BoCode gives a project two halves: `code/` (the source) and `book/` (the documentation stream and knowledge base), driving each other in both directions. You will install: the `book/` skeleton, the index tooling, the git policy tooling (optional), the four skills, and an `AGENTS.md` entry point. You will migrate the project's existing docs into the book. You will **not** refactor any code.
BoCode gives a project two halves: `code/` (the source) and `book/` (the documentation stream and knowledge base), driving each other in both directions. You will install: the `book/` skeleton, the index tooling, the git policy tooling (optional), the four skills, an `AGENTS.md` entry point, and a `.bocode-version` stamp so future upgrades know the baseline. You will migrate the project's existing docs into the book. You will **not** refactor any code.

Before starting, read in the BoCode repository: `AGENTS.md`, `book/guidelines/workflow.md`, and `skills/README.md` — this playbook assumes you know the target shape.

Expand Down Expand Up @@ -63,15 +63,20 @@ Adapt BoCode's `AGENTS.md`: fill the project overview (what it is, in two senten

1. Index generator: zero warnings, exit 0.
2. `git config core.hooksPath .githooks` (if adopted) and the hook fires on commit.
3. Commit the adoption. Follow the project's existing commit convention unless the user chooses to adopt Clean Commit — their call, not yours.
4. Don't rewrite git history. Adoption is ordinary commits on top of what exists.
3. Write `.bocode-version` at the project root — one line with the BoCode repository's current HEAD SHA (`git -C <bocode-clone> rev-parse HEAD`). Future upgrades diff against it.
4. Commit the adoption. Follow the project's existing commit convention unless the user chooses to adopt Clean Commit — their call, not yours.
5. Don't rewrite git history. Adoption is ordinary commits on top of what exists.

## Step 8 — First writeback

1. Finalize the two draft guidelines with the user (Step 1).
2. Write the project's own `ADR-001: adopt the BoCode workflow` in `book/docs/decisions/` — context from the inventory, the Option A/B decision and why, consequences.
3. Regenerate the index. Done.

## Later upgrades

When the BoCode template evolves, hand `UPGRADE.md` from the BoCode repository to an agent — it diffs the project's `.bocode-version` stamp against template HEAD, refreshes template-owned files, and leaves the project's own records untouched. `CHANGELOG.md` lists every change since the stamp.

## What not to do

- No code refactoring, renaming, or "improvements" — structure only; behavior is out of scope
Expand Down
5 changes: 5 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ Feature development strictly follows the six-phase gate workflow — see `book/g

Git commits and branching strictly follow `book/guidelines/git-workflow.md`: every non-merge commit uses the Clean Commit format; independent big features branch from `dev`; small verified fixes may commit to `dev` directly; PRs serve multi-contributor work and the `dev → main` release, which only ever merges. Never commit or push directly to `main`.

## Staying current

This workflow's template evolves. To sync an installed project, an agent reads `UPGRADE.md` and `CHANGELOG.md` from the BoCode repository (https://github.com/Focus695/BoCode) — the project's `.bocode-version` stamp records what it last synced to.

## Document routing

| Output | Location | Audience |
Expand Down Expand Up @@ -74,3 +78,4 @@ Local commands are disposable and have no production access — npm scripts, tes
- `cd code && npm run book:index` — regenerate `book/README.md` after any book change (do not edit by hand; missing frontmatter `description` warns and exits 1)
- `cd code && npm run book:release-check` — verify the tree holds no instance working records; must be green before the `dev → main` release PR
- `node scripts/check-commit-message.mjs "<subject>"` — validate a commit subject against Clean Commit
- `node scripts/check-release-changelog.mjs <base> <head>` — release gate: a dev→main range that touches template-owned content must also update `CHANGELOG.md` (ADR-007)
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Changelog

Releases of the BoCode template itself. Adopting projects upgrade by handing [UPGRADE.md](UPGRADE.md) to an agent; each entry lists what changed and what an adopting project must do. History before 2026-11-05 lives in git log and [book/docs/decisions/](book/docs/decisions/) (ADR-001..ADR-004).

## 2026-11-05 — template updates reach adopters (ADR-007)

The upgrade mechanism itself, plus a link-integrity fix.

- Added: `CHANGELOG.md` (this file), `UPGRADE.md` (the agent-facing upgrade playbook), `scripts/check-release-changelog.mjs` (release gate, wired into `.github/workflows/git-policy.yml`), `.bocode-version` stamping (written at adoption by `ADOPT.md` / `scripts/init-project.sh`)
- Changed: `book/guidelines/workflow.md` — the four ADR-005/006 references are plain text now (as links they broke the index build in projects that copy `guidelines/` only); `book/docs/decisions/README.md` — its ADR-001 link got the same fix; `AGENTS.md` (a Staying-current section + a fourth tooling command); `book/guidelines/git-workflow.md` (release prerequisite); `ADOPT.md` and `scripts/init-project.sh` (version stamp + upgrade pointers); `README.md` / `README.zh-CN.md` / `README.ja.md` (FAQ entry); `skills/bocode/SKILL.md` (upgrade contract)

**Adopter action:** nothing to copy. Projects adopted before this entry have no `.bocode-version` — run UPGRADE.md once to stamp the baseline (its no-stamp fallback path), then stay on the normal procedure.

## 2026-11-05 — experience-first design (ADR-006)

Steve Jobs's product philosophy distilled into the design phases: the request is a proxy for an experience, design is how it works, focus is saying no, and the gate is the polish point.

- Changed: `skills/boscope/SKILL.md` (Step-0 duty D "Stated → experienced"; the exclusions note gains "focus is saying no"; Phase-2 output adds experience surfaces and a "Design is how it works" paragraph; Phase-4 gains the polish line); `book/guidelines/workflow.md` (three what/why sentences); `book/guidelines/review-checklist.md` (ninth → tenth check: experience seams treated as design); `book/guidelines/README.md` (row wording)

**Adopter action:** copy the four changed files (merge `review-checklist.md` if you customized it); sync translated variants of boscope (e.g. structured-feature-implementation) with the same four insertions.

## 2026-11-05 — first principles in the design phases (ADR-005)

Elon Musk's engineering method distilled into the design phases: requirements face a physics test, estimates derive bottom-up, deletion precedes optimization.

- Changed: `skills/boscope/SKILL.md` (Step-0 duty C "Inherited → question"; Phase-2 "Derive, don't analogize" and "Delete before you optimize"; Phase-4 iteration line); `book/guidelines/workflow.md` (Step-0 and Phase-2 sentences); `book/guidelines/review-checklist.md` (eighth → ninth check: parts that trace to no requirement); `book/guidelines/README.md` (row wording)

**Adopter action:** copy the four changed files (merge `review-checklist.md` if you customized it); sync translated variants of boscope with the same three insertions.
4 changes: 4 additions & 0 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,16 @@ cp -r skills/bocode skills/boscope skills/book-writeback skills/bowrite <your-sk
| `code/tools/gen-book-index.mjs` | インデックスジェネレータ |
| `scripts/init-project.sh` | テンプレート → あなたのプロジェクト |
| `scripts/check-commit-message.mjs` | Clean Commit バリデータ(`.githooks/` 付き) |
| `scripts/check-release-changelog.mjs` | リリースゲート:テンプレート変更には CHANGELOG 記載が必須 |

## FAQ

**すでに存在するプロジェクトに BoCode を導入できますか?**
はい——[ADOPT.md](ADOPT.md) を AI エージェントに渡してください。エージェント向けに書かれた段階的な移行プレイブックです:棚卸し、book スケルトン、レイアウト決定、ドキュメント移行、ツールチェーン、スキル、最初の書き戻し。手動の道もあります:`book/`、`skills/`、`scripts/`、`.githooks/`、`AGENTS.md`、`code/tools/` をコピーし、既存ドキュメントを book に統合し、インデックスジェネレータを実行するだけです。

**プロジェクトが古い BoCode を使っていますが、アップグレードは?**
[UPGRADE.md](UPGRADE.md) を AI エージェントに渡してください。プロジェクトの `.bocode-version` スタンプと現在のテンプレートを diff し、テンプレート所有のファイル(guidelines、スキル、ツール)だけを更新し、あなた自身の記録には触れません。[CHANGELOG.md](CHANGELOG.md) にスタンプ以降のすべての変更が並んでいます。

**言語やスタックに縛られますか?**
いいえ。book は Markdown、二つのスクリプトは依存ゼロのプレーン Node です。`code/` には何を置いても構いません——テンプレート自身の `code/` にはツールしか入っていません。

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,16 @@ Requirements: `bash` and `node` for the two scripts. No packages, no install ste
| `code/tools/gen-book-index.mjs` | The index generator |
| `scripts/init-project.sh` | Template → your project |
| `scripts/check-commit-message.mjs` | Clean Commit validator (+ `.githooks/`) |
| `scripts/check-release-changelog.mjs` | Release gate: template changes need a CHANGELOG entry |

## FAQ

**I have an existing project. Can I adopt BoCode?**
Yes — hand [ADOPT.md](ADOPT.md) to your AI agent. It's a step-by-step retrofit playbook written for agents: inventory, book skeleton, layout decision, doc migration, tooling, skills, and the first writeback. The manual path also works: copy `book/`, `skills/`, `scripts/`, `.githooks/`, `AGENTS.md`, and `code/tools/` in, merge your existing docs into the book, and run the index generator.

**My project adopted an older BoCode — how do we upgrade?**
Hand [UPGRADE.md](UPGRADE.md) to your AI agent. It diffs your project's `.bocode-version` stamp against the current template, refreshes template-owned files (guidelines, skills, tooling), and never touches your own records. [CHANGELOG.md](CHANGELOG.md) lists every change since your stamp.

**Does it lock me into a language or stack?**
No. The book is Markdown; the two scripts are plain Node with zero dependencies. Your `code/` can hold anything — the template's own `code/` contains only the tooling.

Expand Down
4 changes: 4 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,16 @@ cp -r skills/bocode skills/boscope skills/book-writeback skills/bowrite <your-sk
| `code/tools/gen-book-index.mjs` | 索引生成器 |
| `scripts/init-project.sh` | 模板 → 你的项目 |
| `scripts/check-commit-message.mjs` | Clean Commit 校验器(含 `.githooks/`) |
| `scripts/check-release-changelog.mjs` | 发布门禁:模板变更必须带 CHANGELOG 条目 |

## 常见问题

**已经有项目了,能套用 BoCode 吗?**
能。把 [ADOPT.md](ADOPT.md) 交给你的 AI agent——这是写给 agent 的分步改造手册:盘点项目、搭 book 骨架、定布局、迁文档、装工具链和 skills、写第一笔回写。想手工来也行:把 `book/`、`skills/`、`scripts/`、`.githooks/`、`AGENTS.md`、`code/tools/` 拷过去,已有文档并进 book,跑一次索引生成。

**我的项目装的是老版 BoCode,怎么升级?**
把 [UPGRADE.md](UPGRADE.md) 交给你的 AI agent。它会拿项目里的 `.bocode-version` 戳和当前模板做 diff:模板属主的文件(guidelines、skills、工具)刷新,你自己的记录一个不动。[CHANGELOG.md](CHANGELOG.md) 列着戳之后的所有变更。

**会绑死语言或技术栈吗?**
不会。book 全是 Markdown,两个脚本是零依赖纯 Node。`code/` 里放什么随意——模板自己的 `code/` 也只放了工具。

Expand Down
42 changes: 42 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Upgrading an installed BoCode

> **This file is for AI agents.** A project adopted the BoCode workflow at some point in the past; the template has moved on. Your job: bring the installed copy up to date without touching the project's own content. Follow it top to bottom.

The BoCode repository: https://github.com/Focus695/BoCode — its `CHANGELOG.md` tells you what changed; this file tells you how to apply it.

## What is template-owned vs project-owned

The one table that decides everything. Template-owned files get refreshed; project-owned files are never touched.

| Template-owned (refresh) | Project-owned (never touch) |
|--------------------------|------------------------------|
| `book/guidelines/{README,workflow,writing-style,git-workflow,review-checklist}.md` | `AGENTS.md`, root `README.md` |
| the `README.md` of every `book/` directory (`docs/`, `docs/decisions/`, `docs/architecture/`, `docs/api/`, `notes/`, `plans/`, `changelogs/`) | `book/guidelines/architecture.md` and `coding-style.md` (project drafts since adoption) |
| `skills/` — all four skills plus `skills/README.md` | everything under `book/docs/decisions/`, `book/docs/architecture/`, `book/docs/api/` (the project's own records) |
| `code/tools/*.mjs`; the `scripts` block of `code/package.json` (keep the project's `name`) | everything under `book/notes/`, `book/plans/`, `book/changelogs/` |
| `scripts/check-*.mjs` (if adopted), `.githooks/` (if adopted), `.github/workflows/git-policy.yml` (if adopted — keep the template-clean step deleted, per ADOPT.md) | `book/README.md` (generated — regenerate, don't copy), `.bocode-version` |

## The procedure

1. Read `.bocode-version` at the project root: it holds the BoCode commit the project last synced to. No stamp (adopted before 2026-11-05)? Use the fallback below.
2. Clone the BoCode repository in full — not `--depth 1`, the stamp's commit must be reachable: `git clone https://github.com/Focus695/BoCode /tmp/bocode`.
3. List what changed: `git -C /tmp/bocode diff --name-status <stamp>..HEAD`, keep the rows that match the template-owned column, and read the `CHANGELOG.md` entries after the stamp for the intent and each entry's **Adopter action**.
4. Apply, per file:
- project copy unmodified since adoption (matches the stamp's template version) → copy the new version over it
- project copy modified → merge by hand: take the template's changes, keep the project's edits, ask the user where they collide
- project-owned path → never touch
5. Sync translated variants of the skills (e.g. a localized boscope) with the same insertions, if the project keeps any.
6. Regenerate and verify: `cd code && npm run book:index` must end with zero warnings and all links resolving.
7. Update `.bocode-version` to the new HEAD SHA (`git -C /tmp/bocode rev-parse HEAD`).

ADR numbers referenced in the guidelines (e.g. "ADR-006") are the template's own records — read them in the BoCode repository's `book/docs/decisions/`.

## Fallback: no stamp

Projects adopted before the stamp existed have no baseline. Walk `CHANGELOG.md` top to bottom instead: every entry's **Adopter action** names the files it touched — compare each against the project's copy; identical or trivially old → apply per the rules above; project-modified → merge; conflicts → ask the user. Then stamp the current HEAD SHA and continue on the normal procedure.

## What not to do

- Never overwrite a project-owned file — records, drafts, and ADRs belong to the project
- Never re-add the "Check template cleanliness" step to a copied `git-policy.yml` (that gate is the template repo's own, per ADOPT.md)
- Don't invent version numbers: the stamp is a commit SHA, and that is the whole versioning story (ADR-007)
7 changes: 5 additions & 2 deletions book/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ description: Master index of the book — the map of every document. Regenerate
- [ADR-002-adopt-bowrite.md](docs/decisions/ADR-002-adopt-bowrite.md) — We distill shuorenhua and human-writing plus our own review patterns into bowrite (薄写), an in-repo writing skill — write thin, write well
- [ADR-003-intent-gates-vs-distrust-gates.md](docs/decisions/ADR-003-intent-gates-vs-distrust-gates.md) — We classify workflow gates by justification — intent gates stay hard, distrust gates soften as models improve; Phase 2 approval becomes gap-based stopping
- [ADR-004-template-free-of-instance-records.md](docs/decisions/ADR-004-template-free-of-instance-records.md) — This repository ships template content only — instance working records (notes entries, plans, changelog months) never enter it; a release check enforces the boundary
- [ADR-005-distill-first-principles-into-design-phases.md](docs/decisions/ADR-005-distill-first-principles-into-design-phases.md) — Musk's first-principles engineering method is woven into the design phases — requirements face a physics test, estimates derive bottom-up, deletion precedes optimization
- [ADR-006-distill-experience-first-design-into-phases.md](docs/decisions/ADR-006-distill-experience-first-design-into-phases.md) — Jobs's experience-first craft is woven in beside ADR-005 — the request is a proxy for an experience, design is how it works, focus is saying no, and gates are the polish point
- [ADR-007-template-updates-reach-adopters.md](docs/decisions/ADR-007-template-updates-reach-adopters.md) — Template updates reach adopters through a root CHANGELOG, an agent-facing UPGRADE playbook, and a .bocode-version stamp — release-gated by CI; semver rejected, the commit SHA is the baseline
- [README.md](docs/decisions/README.md) — How to write an ADR here — sections, naming, numbering, and when a decision needs a record

### guidelines/
Expand All @@ -60,7 +63,7 @@ description: Master index of the book — the map of every document. Regenerate
- [architecture.md](guidelines/architecture.md) — Template for your project's long-term architecture rules — boundary invariants, module map, tech baseline, with a worked example of boundary-style rules
- [coding-style.md](guidelines/coding-style.md) — Template for your project's coding baseline — the language-specific rules any contributor or agent must follow
- [git-workflow.md](guidelines/git-workflow.md) — Clean Commit message format and Clean Flow branch, PR, and merge rules for solo and team development
- [review-checklist.md](guidelines/review-checklist.md) — The eight code-review checks every change must pass — findings are recorded, never fixed in passing
- [review-checklist.md](guidelines/review-checklist.md) — The ten code-review checks every change must pass — findings are recorded, never fixed in passing
- [workflow.md](guidelines/workflow.md) — Six-phase gate workflow with the eight code↔book interaction rules and the document routing table
- [writing-style.md](guidelines/writing-style.md) — Plain-language writing standard for every book document — fidelity contract first, then minimal style rules, intensity levels, and a read-back check

Expand All @@ -72,4 +75,4 @@ description: Master index of the book — the map of every document. Regenerate

- [README.md](plans/README.md) — Plans directory usage — implementation plans land here after Phase 2 approval, with naming and the plan template

<!-- 18 documents -->
<!-- 21 documents -->
Loading
Loading