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
95 changes: 95 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Contributing to Codex Decoded

Thanks for your interest in improving **Codex Decoded** — a source-level field guide to
[`openai/codex`](https://github.com/openai/codex). Corrections, clearer explanations,
better diagrams, and coverage of new subsystems are all welcome.

This guide covers how to propose changes, the conventions we follow, and how the
review pipeline works.

## Ground rules

- **Accuracy first.** This is a *source-level* guide. Every claim, code excerpt, and
diagram should reflect the actual Codex source. When you add or change technical
content, reference the file(s) it comes from in your PR description (e.g.
`codex-rs/core/src/tools/registry.rs`).
- **Match the house style.** Keep prose tight and explanatory; keep code excerpts
real and minimal; keep diagrams legible. Look at an existing finished chapter
(e.g. `src/chapters/ch5.js`, `ch9.js`, `ch13.js`) as the reference for depth and tone.
- **Small, focused PRs.** One chapter, fix, or feature per PR is easiest to review.

## Getting set up

```bash
git clone https://github.com/BenAlaa/codex-decoded.git
cd codex-decoded
npm install
npm run dev # http://localhost:5173 — live guide with hot reload
npm run build # production build into dist/ (must pass before a PR can merge)
npm run preview # serve the built dist/ locally
```

Requires Node 20+.

## Project layout

See the **Project layout** and **How it works** sections in the [README](README.md).
In short:

- `src/chapters/<id>.js` — one module per page, default-exporting a `() => htmlString`.
- `src/chapters/index.js` — the `CONTENT` registry mapping chapter id → render function.
- `src/data/book.js` — table of contents and ordering (`BOOK` / `FLAT`).
- `src/lib/*` — shared helpers (`code`, `mmd`, `fullPrompt`, graph, map, …).
- `src/prompts/*.txt` — the verbatim Codex system prompts.
- `src/styles/*` — design tokens and component styles.

## Making common changes

- **Edit a chapter** — change its module in `src/chapters/`. Compose content with the
helpers already imported at the top of the file (`code`, `mmd`, `fullPrompt`, …).
- **Add a chapter** — create `src/chapters/<id>.js`, register it in
`src/chapters/index.js`, and add its entry to `src/data/book.js` so it appears in the
table of contents.
- **Add/replace a prompt** — drop a `.txt` file in `src/prompts/`, import it in
`src/lib/prompts.js`, and key it `pr-<name>` so `fullPrompt('pr-<name>', …)` resolves.
- **Diagrams** — build them with the `mmd()` helper (Mermaid) or the D3/Chart.js
helpers in `src/lib/graph.js`. Verify they render in `npm run dev`.

## Commit conventions

We use [Conventional Commits](https://www.conventionalcommits.org/). Examples from the
existing history:

- `feat(ch14): add chapter 14 — Dispatch lifecycle`
- `fix(ch16): correct apply_patch grammar excerpt`
- `docs: expand README with chapter overview`
- `chore: bump vite`

Common types: `feat`, `fix`, `docs`, `style`, `refactor`, `chore`, `ci`. Use the
chapter id (`ch5`, `cover`, `map`, …) as the scope for content changes.

## Pull request workflow

`main` is protected — all changes land through pull requests:

1. Branch off `main` (`git switch -c feat/my-change`).
2. Make your change and confirm **`npm run build` passes** locally.
3. Push and open a PR against `main`.
4. **CI** runs a build check on your PR — it must pass.
5. A maintainer reviews and approves; then the PR is merged.
6. On merge, the site auto-deploys to
[GitHub Pages](https://benalaa.github.io/codex-decoded/).

Direct pushes to `main`, force-pushes, and branch deletion are disabled.

## Licensing of contributions

By contributing, you agree that your contributions are licensed under the same terms
as the project (see the [License](README.md#license) section):

- **Code** — [MIT](LICENSE).
- **Book content** (prose, diagrams, images) — [CC BY 4.0](LICENSE-CONTENT).

Only contribute material you have the right to submit under these terms. The verbatim
Codex prompts reproduced here originate from `openai/codex` (Apache-2.0); don't add
third-party material that is incompatible with the project's licenses.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Ahmed Alaa

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading
Loading