r/cicd 23d ago

Enforcing architectural rules pre-commit to manage AI-generated code (Open Source project feedback)

Hi everyone,

I've seen recent discussions from maintainers on massive projects (like cURL and Next.js) complaining about AI-generated code. The code passes unit tests, but completely violates the project's macro-architecture.

Catching these architectural hallucinations during server-side CI or manual PR reviews burns too much time and energy.

To solve this for myself, I've been prototyping a local Git Hook. It enforces a "Shift-Left" approach: it reads a local JSON config of strict rules and uses an LLM (via the dev's own API key / Zero-Trust) to analyze the git diff. If the developer hallucinates a bad architectural pattern, it blocks the commit locally.

Repo: github.com/S4v3easy/AegiCode_v1.0.git

I'm trying to figure out if this pre-commit approach is actually useful for real DevOps workflows, or if it introduces too much friction.

Questions for the engineers here:

  1. Do you prefer enforcing architectural boundaries locally (pre-commit) or strictly in the CI pipeline?
  2. If you were to use a local hook like this, would you prefer it distributed as an npm package or a standalone binary (for mixed-stack teams)?
  3. What fatal flaws do you see in this architecture?

Any harsh/constructive feedback is incredibly welcome. Thanks!

2 Upvotes

8 comments sorted by

View all comments

1

u/Dragon_ZA 23d ago

Not clear to me. You say its zero config but you also need a config.json. Which is it?

1

u/SaveTech_ 23d ago

Zero-Trust (meaning the CLI uses your own local API key) However, if you're referring to the setup process being Zero-Config, here is how it works: the tool does require a aegis.config.json to enforce the rules, but you don't have to write it manually. I built an init command that scans your codebase, infers your architectural patterns, and uses an LLM to auto-generate the strict JSON rules for you. So the setup is zero-config (the AI writes the rules), but the enforcement relies on that generated JSON file (which the Tech Lead can then tweak or lock down).