๐Ÿ— KeyzHub
19Keys ยท community archive
5650 bytes raw
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# Setup

This repo is the **build-your-own-x** tutorial index (`README.md`) wrapped in
a **harness** (`AGENTS.md`, `feature_list.json`, `init.sh`, `progress.md`,
`session-handoff.md`) that lets a coding agent build one tutorial to
completion, across sessions, without losing the thread. It ships
preconfigured for **"Build your own Git" in Python**.

There is nothing to compile or serve. Setup here means: get the three tools
on your machine that `init.sh` and the preconfigured challenge actually use.

## What you need

| Requirement | Why | Have it already? |
|---|---|---|
| `git` (any recent version) | `init.sh` warns if missing; the git-python challenge's tests compare your implementation's output byte-for-byte against real git | Run `git --version` |
| `python3` (any recent version) | Runs `init.sh`'s checks and the challenge's `pytest` test suite | Run `python3 --version` |
| `pytest` (Python package) | `init.sh` requires it to run the challenge's test suite | Run `python3 -c "import pytest"` |
| `bash` | `init.sh` is a bash script (`#!/usr/bin/env bash`) | macOS/Linux ship one already โ€” run `bash --version` |
| A coding agent (Claude Code recommended) | `AGENTS.md` is written for an agent to read first and follow the workflow; you can also do it by hand | Not required to have one โ€” you can read `AGENTS.md` yourself and code manually |

**NOT needed:** Docker. No account or sign-up of any kind. No GPU. No paid
API or API key of any kind โ€” nothing in this repo calls out to a network
service. No Node/npm (only pulled in if you later swap to a JS/TS
challenge โ€” see `.gitignore`'s node note, which is just future-proofing).

## Install, step by step

### 1. Install Homebrew (macOS only, skip if you already have it)

```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
Installs the Homebrew package manager, used below to install git/python3 if needed.

Check it worked:
```bash
brew --version
```
Expected: a line like `Homebrew 4.x.x`.

### 2. Install git

macOS:
```bash
brew install git
```
Linux (Debian/Ubuntu):
```bash
sudo apt-get update && sudo apt-get install -y git
```
Windows:
```powershell
winget install --id Git.Git -e
```
This installs the real `git` binary the challenge's tests will diff your output against.

Check it worked:
```bash
git --version
```
Expected: `git version 2.x.x` (any recent 2.x is fine).

### 3. Install Python 3

macOS:
```bash
brew install python3
```
Linux (Debian/Ubuntu):
```bash
sudo apt-get install -y python3 python3-pip
```
Windows: download the installer from python.org and run it (check "Add python.exe to PATH").

Check it worked:
```bash
python3 --version
```
Expected: `Python 3.x.x`.

### 4. Install pytest

```bash
python3 -m pip install pytest
```
This is the test runner `init.sh` invokes (`python3 -m pytest tests -q`) once a challenge workspace with tests exists.

Check it worked:
```bash
python3 -c "import pytest; print(pytest.__version__)"
```
Expected: a version number printed, no `ModuleNotFoundError`.

### 5. Clone this repo

```bash
git clone <this-repo-url>
cd build-your-own-x-harness
```

Check it worked:
```bash
ls AGENTS.md feature_list.json init.sh
```
Expected: all three filenames echoed back with no "No such file" error.

## Configure

Nothing to configure. No environment variables, no config files, no API
keys โ€” the harness and the preconfigured git-python challenge are fully
local and offline.

## Run it

```bash
./init.sh
```

On a fresh clone, expected output ends with:
```
NOTE: workspace/git-python does not exist yet.
      This is expected before the first feature is started.
      Create it, add your implementation + tests/, then re-run ./init.sh
```
and the script exits with code `2`. That is success for a fresh clone โ€” it
means the harness is wired up correctly and no feature has been built yet.

From here, either:
- Point a coding agent (e.g. Claude Code) at this directory and tell it to
  start โ€” a well-behaved agent reads `progress.md`, `feature_list.json`,
  `session-handoff.md`, runs `./init.sh`, and begins the `init` feature
  itself, per `AGENTS.md`.
- Or follow `AGENTS.md` and `progress.md` by hand: create
  `workspace/git-python/tests/`, write `tests/test_init.py` against the
  `init` feature's `done_criteria` in `feature_list.json`, implement `init`,
  then re-run `./init.sh`.

`init.sh` exit codes, so you always know what state you're in:
- **0** โ€” all tests in the active challenge's `tests/` directory pass.
- **1** โ€” a real failure: a required tool is missing (`python3`, or `pytest`
  not importable), or the test suite ran and is red.
- **2** โ€” nothing to run yet: `workspace/<challenge>/` doesn't exist, or it
  exists but has no `tests/` directory. Not a bug โ€” expected before the
  first feature is scaffolded.

## Troubleshooting

1. **`FAIL: python3 not found on PATH`** โ€” Python isn't installed or isn't
   on PATH. Re-run step 3 above, then open a new terminal so PATH updates
   take effect.
2. **`FAIL: pytest not importable`** โ€” `pytest` isn't installed for the
   `python3` that's first on your PATH. Run
   `python3 -m pip install pytest` (step 4), and if you have multiple Python
   installs, make sure you're installing into the same `python3` that
   `init.sh` will call (check with `which python3`).
3. **`./init.sh` exits `2` and never seems to progress past it** โ€” this
   means `workspace/git-python/tests/` doesn't exist yet. That directory is
   created by whoever (you or your agent) implements the first feature
   (`init`) โ€” it isn't pre-seeded. See "Run it" above for the next step.