What it is

CI stands for continuous integration. It means: every time you push code, a computer
somewhere runs your checks automatically and tells you if anything broke.

You already have the checks. This runs them without you remembering to.

Why it matters more when you work with agents

You are producing much more change than you used to, and a lot of it you did not write. Your
attention is the scarce thing (Lesson 4.6).

CI is attention you do not have to spend. It never gets tired, never skips a step because it
is late, and never assumes it is fine because the last twenty were.

Set it up

Add GitHub Actions CI.

Goal:
On every push and every pull request, run npm test on a clean machine.

Requirements:
- Use the Node version in package.json.
- Install dependencies from the lock file.
- Fail the build if type check, lint, or tests fail.
- Nothing else. No deploying, no publishing.

Done when: a push shows a green or red mark on the commit.

The check that proves it works

Push something broken on purpose. On a branch, not your main one.

git checkout -b test-ci
# break a test
git commit -am "deliberately broken"
git push -u origin test-ci

Wait for the red mark. Then delete the branch.

CI you have never seen fail is CI you do not know works. This takes three minutes and it is
worth doing once.

The clean machine catches a specific thing

CI runs on a computer that has nothing installed. That catches the most annoying bug in
software: it works for you because of something on your machine that you forgot you
installed.

That bug is hard to find locally and obvious in CI.

Try this before the next lesson

  1. Set up CI. Push a broken commit on a branch and watch it go red.
  2. Make CI run on a clean checkout. Does anything fail that passes locally?
  3. Add the green mark to your project’s README.