Metadata-Version: 2.4
Name: archiet-microcodegen
Version: 0.2.0
Summary: Archiet's core algorithm in one file: PRD text -> FastAPI app ZIP, pure stdlib, zero dependencies.
Project-URL: Homepage, https://archiet.com
Project-URL: Source, https://github.com/aniekanasuquookono-web/archiet
Project-URL: Issues, https://github.com/aniekanasuquookono-web/archiet/issues
Project-URL: Spec File, https://github.com/aniekanasuquookono-web/archiet/blob/main/scripts/microcodegen.py
Author-email: Aniekan Okono <founder@archiet.com>
License: MIT License
        
        Copyright (c) 2026 Archiet (Aniekan Okono)
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: api-generator,archiet,codegen,fastapi,microcodegen,prd,scaffolding
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Code Generators
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# archiet-microcodegen

> **Archiet's core algorithm in one file.** PRD text → manifest → genome → rendered FastAPI app → ZIP, in <1400 LOC, with zero imports from `app.*`, `agents.*`, or templates. Pure stdlib. No LLM calls.

Inspired by Karpathy's `micrograd` philosophy: *this file is the complete algorithm; everything else in Archiet is just efficiency on top.*

## Install

```bash
pip install archiet-microcodegen
```

## Use

```bash
archiet-microcodegen path/to/prd.md --out ./out/
```

Or pipe to a ZIP:

```bash
archiet-microcodegen path/to/prd.md > app.zip
```

As a library:

```python
from archiet_microcodegen import microcodegen

prd_text = open("prd.md").read()
zip_bytes = microcodegen(prd_text)
```

## What you get

The generated output is a working FastAPI + PostgreSQL app with:

- **FastAPI** with `/docs` interactive OpenAPI explorer — auto-generated, free
- **SQLAlchemy 2.0 models** (one per entity, `DeclarativeBase`)
- **Pydantic v2 schemas** — `Base` / `Create` / `Update` / `Response` per entity
- **JWT auth** via httpOnly cookies — `register` / `login` / `logout` / `me`; never localStorage
- **Full CRUD per entity** — list, create, get, update, delete; all behind `Depends(get_current_user)`
- **Per-tenant data isolation** — every row has a `user_id` FK; every query filters by it
- **Alembic migrations** — `alembic.ini` + `alembic/env.py` pre-configured
- **pytest test suite** — `TestClient`, DB override via `dependency_overrides`, auto-skip if Postgres unreachable
- **docker-compose.yml** — Postgres 16 with healthcheck-gated startup
- **ARCHITECTURE.md** — ArchiMate 3.2 element map (ApplicationComponent, DataObject, BusinessProcess, ApplicationService)
- **openapi.yaml** — machine-readable API contract, importable into Postman or Swagger UI

Zero LLM calls. Zero API keys. Pure Python stdlib.

## The four stages

1. **`parse_prd(text) → manifest`** — regex extraction of entities, fields, user stories, integrations
2. **`manifest_to_genome(manifest) → genome`** — maps to the canonical IR with ArchiMate 3.2 element typing
3. **`render_genome(genome) → {path: content}`** — `string.Template`-based FastAPI rendering
4. **`pack(files) → bytes`** — stdlib `zipfile`

## Why this exists

This is the **spec**. The full platform ([archiet.com](https://archiet.com)) adds:

- LLM-powered PRD extraction (chunked, overlap+dedup, handles natural language)
- 12+ stack renderers (Flask, FastAPI, Django, NestJS, Laravel, Go, Java, Rails, .NET, Tauri+Rust, Salesforce, SAP CAP, Dynamics)
- Capability emission, frontend (Next.js / Expo), stub-filling, quality scoring, delivery gates
- Cross-stack parity enforcement and verification

But none of that changes the **core algorithm**. If a bug doesn't reproduce in `microcodegen`, it's in an efficiency layer, not the spec.

## What's NOT included

- No LLM calls (deterministic zone by design)
- No frontend, no mobile, no payment integration, no rate limiting, no audit logging
- No multi-stack output (FastAPI only; that's the algorithmic baseline)

For the full platform, see [archiet.com](https://archiet.com).

## License

MIT. See [LICENSE](https://github.com/Anioko/microcodegen/blob/main/LICENSE).

## Links

- Source: [github.com/Anioko/microcodegen](https://github.com/Anioko/microcodegen)
- Issues: [github.com/Anioko/microcodegen/issues](https://github.com/Anioko/microcodegen/issues)
- Full platform: [archiet.com](https://archiet.com)
