Dan Romero

Open-source a private project

Updated

A prompt that has a coding agent prepare a public copy of a private project, with no secrets, private names or development history in it. You keep working in private, and each release goes public as one commit you push yourself.

807 words

Help me publish a public copy of this private project. I keep working here. The public repo gets one commit per release, built from a list of folders, and only I push it. First ask me, in one short message, which folders go public, which license, the public repo’s name, and whether a public repo already exists.

Rules

Lay out the repo

Audit everything that would go public

Read every file in the export, not just recent changes:

The publish script

Write publish/publish.sh with three modes: --check shows what would change and runs the leak checks, "<message>" also makes the commit in a scratch clone, and "<message>" --push, which only I run. It must:

  1. Refuse a dirty tree, and a commit that isn’t pushed to this repo, so everything public is also here.
  2. Read the path list from the commit being published, not the checkout.
  3. Shallow-clone the public repo, replace its files with git archive <commit> -- <paths>, and stop on any agent or to-do file, .env, key, signing file, file over 5 MB, secret, or mention of this private repo.
  4. Print the undo command with every push: git push --force origin <previous>:main. It doesn’t unpublish anything: if a secret ever goes public, rotate it.

Prove the leak check works: add the to-do file and a private folder to the list, run --check, and confirm both are blocked. Then take them out.

The public files

The test that proves it

In a fresh clone of the scratch commit, run the public CI’s commands and follow BUILD.md from the top, as a stranger would. A path missing from the list shows up here, not after the push. Record what passed in “What’s untested”.

Then hand me numbered steps: read the commit, create the repo, add the license, push, turn on private vulnerability reporting. If this replaces an old public repo, give it a README saying where the code went and that deployed copies keep working, and ask me before archiving it.