inemaSEO 5 — With Agents: Claude Code and Codex Doing the Repetitive Work|INEMA.CLUB-PRO

Lesson 4 · 17 min

Safe batch operations: dry-run, marker, and dirty repository

Adding a link back in forty repositories, swapping a footer on a hundred pages, fixing a canonical across the whole site: this is where the agent saves you hours, and this is where one mistake spreads. Three protections solve almost everything: show before you do, don't duplicate, and don't touch what someone else is working on.

Start the lesson
A woman sorts stacks of paper into wooden pigeonholes, with a separate box on its side on the table.

In this lesson you will

  1. 1Dry-run by default: see what it would do before doing it
  2. 2Marker: running twice doesn't duplicate
  3. 3Skip the repository with unsaved work
  4. 4Check it live by sample after the push

Goal: run an operation across several repositories with a dry-run, a marker against duplicating, and skipping dirty repos, checking by sample.

01The path of a safe batch

Tap each block.

Click each block in the diagram to see what it does.

Three protections: dry-run, marker, and skipping a dirty repository.

02The protections, one by one

Tap each step.

1. Dry-run

The script's default is not to write. Writing requires asking for it: --apply. That way a mistake in the map shows up in the list, not on the site.

Ask any agent for the same thing: first the list of what it would do, then the run.

03The link back in batch

Swap the paths and destinations for your own.

mapa.json
[{"repo": "repos/curso-pao", "destino": "https://www.seusite.com/cursos/pao/", "rotulo": "Ficha completa"},
 {"repo": "repos/curso-cafe", "destino": "https://www.seusite.com/cursos/cafe/", "rotulo": "Ficha completa"},
 {"repo": "repos/curso-queijo", "destino": "https://www.seusite.com/cursos/queijo/", "rotulo": "Ficha completa"},
 {"repo": "repos/curso-vinho", "destino": "https://www.seusite.com/cursos/vinho/", "rotulo": "Ficha completa"}]
Dry-run, apply, and (after the gate) commit
python3 tools/link_de_volta.py mapa.json             # dry-run: só mostra
python3 tools/link_de_volta.py mapa.json --apply     # grava, sem commit
python3 tools/link_de_volta.py mapa.json --apply --commit   # grava, commita e faz push
Request to the agent
Build the mapa.json with the repositories from the list and run link_de_volta.py with NO options (dry-run).
Show me the full output and stop.
Don't use --apply or --commit until I reply "aplica".
Repository with PULA: don't force it, don't stash, don't commit for it. Just tell me which one it is.
Example from the repository
$ python3 tools/link_de_volta.py mapa.json
repos/curso-pao: DRY: entraria em index.html
repos/curso-cafe: PULA: alterações não commitadas
repos/curso-queijo: OK: já tinha
repos/curso-vinho: DRY: entraria em landing.html

$ python3 tools/link_de_volta.py mapa.json --apply
repos/curso-pao: APLICADO em index.html
repos/curso-cafe: PULA: alterações não commitadas
repos/curso-queijo: OK: já tinha
repos/curso-vinho: APLICADO em landing.html

Four test repositories set up for the lesson.

04See the batch with interruption and resume

Run it, interrupt halfway, and run it again. What's already done isn't redone.

to do/

applying/

done (with marker)/

skipped/

Illustrative simulation in the browser: nothing is actually written. The skip is on purpose, to show the dirty repository.

05Practice: a real batch, over the network

Use 3 or more of your own repositories (or create test repositories with a simple index.html).

E1 · The dry-run

25 min

Ask the agent for the mapa.json and the dry-run, using the request above. Leave one repository with an uncommitted change on purpose.

Done when: the output shows at least one DRY and one PULA with the reason, and the git status of the repositories did not change.

E2 · Apply and check

25 min

Reply "aplica", run with --apply, check the diff of each repository, commit (or use --commit), and run the dry-run again.

Done when: the second run answers "OK: já tinha" in the repositories you applied, and you opened at least 2 published pages and saw the link in the HTML.

06Test what you learned

The explanation appears after your answer.

Question 1 of 4

What does link_de_volta.py do when you run it with no options?skill

07To take with you

Dry-run by defaultSee the list first; write only with --apply.
MarkerRunning twice does not duplicate; resuming is safe.
Dirty means someone else'sA repository with an unsaved change is skipped, not forced.
Push is publishing--commit does a push: go through the gate before it and check a sample after.

Going further

Previous lessonNext lesson