r/coolgithubprojects • • 7d ago

repocraft - a Python project generator that fails closed when a model proposes something that hangs

https://github.com/Furox-Art/repocraft
0 Upvotes

4 comments sorted by

1

u/Emergency-Tutor-7 7d ago

What it does: a short phrase or a small YAML spec becomes a Python artifact - repocraft make "triangle" writes one .py plus one unittest file, and a YAML spec produces a full project with src/ layout, packaging metadata, tests, ruff/pyright config, CI, CodeQL, Dependabot and a JUnit gate that rejects skipped tests. Those paths are deterministic: same input and same version give byte-identical output.

The part I would defend is what happens when a model is in the loop. In the ask path the model only returns a strict {recipe, parameters} intent, validated against the recipe catalog, and never writes a file. In craft it writes the snippet, and nothing reaches disk until it clears the gates: Python syntax, whether the generated tests actually import the module, ruff when installed, and the generated tests themselves. Each gate subprocess runs inside the proposal's temporary directory with a 60-second timeout, a runaway proposal is killed and rejected, and the generated tests run under python -E -s -B.

Install:

pip install repocraft
npm i -g @furox-art/repocraft

Honest limit from the README, and I agree with it: that confinement is not a security sandbox. Creating the GitHub repository is still a roadmap item too.

1

u/da_sher 7d ago

the 60 second timeout gate is a nice touch, a runaway proposal just gets killed instead of hanging the whole run. why 60 though, do legit bigger projects ever get close to that limit?

1

u/Emergency-Tutor-7 7d ago

The 60 seconds is per gate subprocess, and each one runs with its cwd inside the proposal's temporary directory. What times out is killed, and the directory it wrote into is the one that gets discarded, so the target path never sees a write. A timed out gate is a rejection, not a retry.

One thing to keep straight: it is confinement, not a sandbox. The README says that outright. The gates are isolated from the parent interpreter (-E -s -B) and from the filesystem outside their temp dir by cwd, which stops a runaway proposal from writing where it should not. It does not stop code that goes looking for absolute paths.

1

u/Emergency-Tutor-7 5d ago

60 is per gate subprocess, not per build. Ruff, the syntax/import check and the generated test suite each run inside the proposal's temp directory with that limit (_GATE_TIMEOUT_SECONDS = 60.0 in src/repocraft/craft.py), and the generated suites are small by construction, so nothing legitimate comes near it in what I have run.

If a gate overruns, the child is killed and the proposal is rejected rather than left hanging. The timeout is a function parameter (craft(..., timeout=...)), not a CLI flag yet, so that is the lever if a generated suite ever needs more.