Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.DS_Store
*.log
.env
**/venv/
**/__pycache__/
**/node_modules/
**/out/
*.pyc
.pytest_cache/
38 changes: 38 additions & 0 deletions PLAN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Creer — Final Plan

v0.1 delivered the foundation: FastAPI planner/generator + VS Code command that writes a generated repo into the workspace (optional git init).

## v0.2 — done

1. **Preview before writing** — plan preview markdown + confirm before generate/write (`creer.previewBeforeWrite`).
2. **GitHub repo creation** — `POST /github/create-repo` + extension remote add/push.
3. **Curated templates** — `GET /templates` + template-anchored `/plan` & `/generate`.
4. **Overwrite protection** — per-file conflict detection with overwrite / skip / cancel.
5. **Chat command `/creer`** — `creer.createRepoFromChat` + `@creer` chat participant.

## v0.3 — done

1. **Streaming generation** — `POST /generate/stream` (SSE) + extension progress UI.
2. **Local / offline backends** — `OPENAI_BASE_URL`, `CREER_OFFLINE`.
3. **Open-source bake-ins** — LICENSE / README / CI via `bakeins.py`.
4. **Hardening** — `GIT_ASKPASS` + SecretStorage for GitHub tokens.

## v0.4 — done

1. **Cancellation** — `job_id` on stream + `POST /generate/cancel`; extension AbortSignal + cancellable progress.
2. **Selectable bake-ins** — license (`mit` / `apache-2.0` / `none`) and CI presets (`auto` / `python` / `node` / `none`); `GET /bakeins`.
3. **Quality gates** — telemetry-free tree checks (`quality` on generate/done; `POST /quality`).

## v0.5 (optional next)

- Diff preview of generated file contents before write
- Multi-root workspace targeting
- Template packs as installable JSON/YAML

## Non-goals

- Multi-agent orchestration
- Memory graphs
- Overengineered plugin frameworks

Stay power-focused: idea → plan → files → workspace.
135 changes: 135 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Creer

AI-powered repo scaffolding inside your workspace.

Describe an idea → Creer plans a clean structure → optionally preview/confirm → writes files into your VS Code workspace → optionally initializes git and creates a GitHub remote.

**Current version: 0.4.0**

## Architecture

```
creer/
├── backend/ # Python FastAPI AI engine
└── extension/ # VS Code extension
```

## Prerequisites

- Python 3.10+
- Node.js 18+
- OpenAI API key **or** a local OpenAI-compatible server (`OPENAI_BASE_URL`), unless using offline template mode (`CREER_OFFLINE=1`)
- VS Code / Cursor

## Backend (v0.4)

```bash
cd backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
# set OPENAI_API_KEY and/or OPENAI_BASE_URL in .env
uvicorn main:app --reload --port 8000
```

### Environment

| Variable | Description |
|---|---|
| `OPENAI_API_KEY` | OpenAI API key (optional if using `OPENAI_BASE_URL` or `CREER_OFFLINE=1`) |
| `OPENAI_BASE_URL` | OpenAI-compatible base URL (Ollama, LM Studio, etc.). Example: `http://127.0.0.1:11434/v1` |
| `CREER_MODEL` | Model name (default `gpt-4o-mini`) |
| `CREER_OFFLINE` | `1` / `true` / `yes` for template-only stubs (planning requires `template_id`) |

### Endpoints

| Method | Path | Description |
|---|---|---|
| `GET` | `/health` | Version `0.4.0`, offline flag, model |
| `GET` | `/templates` | Curated starter templates |
| `GET` | `/bakeins` | License + CI bake-in options |
| `POST` | `/plan` | Plan only (no file contents) |
| `POST` | `/generate` | Generate files (+ bake-ins + `quality`) |
| `POST` | `/generate/stream` | SSE progress; `start` includes `job_id` |
| `POST` | `/generate/cancel` | Cancel by `job_id` |
| `POST` | `/quality` | Dry-run quality gates |
| `POST` | `/github/create-repo` | Create GitHub repo |

#### Generate body (sync or stream)

```json
{
"idea": "Build a FastAPI todo app",
"template_id": "fastapi-minimal",
"plan": null,
"job_id": null,
"bakeins": {
"license": "mit",
"ci": "auto",
"include_readme": true
}
}
```

`bakeins.license`: `mit` | `apache-2.0` | `none`
`bakeins.ci`: `auto` | `python` | `node` | `none`

#### Stream events

| Event | Meaning |
|---|---|
| `start` | Includes `job_id`, `total`, `project_name` |
| `file` | Per-file `generating` / `done` |
| `done` | Full `files` map + `quality` |
| `cancelled` | Stopped via `/generate/cancel` |
| `error` | Failure detail |

```bash
curl -N -X POST http://localhost:8000/generate/stream \
-H "Content-Type: application/json" \
-d '{"idea":"todo api","template_id":"fastapi-minimal"}'
```

## Extension (v0.4)

```bash
cd extension
npm install
npm run compile
```

1. Open `extension/` → **F5**
2. Open a workspace folder
3. **Creer: Create New Repo**
4. Pick template → license/CI → confirm preview → generate (cancellable while streaming)

### Commands

| Command | Title |
|---|---|
| `creer.createRepo` | Creer: Create New Repo |
| `creer.createRepoFromChat` | Creer: Create from Chat Prompt |
| `creer.setGitHubToken` | Creer: Set GitHub Token |
| `creer.clearGitHubToken` | Creer: Clear GitHub Token |

### Settings

| Setting | Default | Description |
|---|---|---|
| `creer.backendUrl` | `http://localhost:8000` | Backend base URL |
| `creer.initGit` | `true` | `git init` + initial commit |
| `creer.previewBeforeWrite` | `true` | Confirm plan before generate |
| `creer.useStreaming` | `true` | SSE progress (cancellable) |
| `creer.promptBakeins` | `true` | QuickPick license/CI each run |
| `creer.license` | `mit` | Used when not prompting |
| `creer.ciPreset` | `auto` | Used when not prompting |
| `creer.createGitHubRepo` | `false` | Create GitHub remote after scaffold |
| `creer.githubPrivate` | `true` | Private GitHub repos |
| `creer.githubToken` | `""` | **Deprecated** — use SecretStorage |

GitHub push uses `GIT_ASKPASS` (token never on argv/URL).

## License

MIT
13 changes: 13 additions & 0 deletions backend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# OpenAI API key (required unless CREER_OFFLINE=1 or using a local server that ignores it)
OPENAI_API_KEY=sk-your-key-here

# Optional OpenAI-compatible base URL for local/offline backends (Ollama, LM Studio, vLLM, etc.)
# Example: http://127.0.0.1:11434/v1
OPENAI_BASE_URL=

# Model name (OpenAI or local-compatible)
CREER_MODEL=gpt-4o-mini

# Template-only / stub generation — never calls the LLM
# Set to 1, true, or yes to enable
CREER_OFFLINE=
6 changes: 6 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.env
venv/
__pycache__/
*.pyc
.pytest_cache/
.mypy_cache/
1 change: 1 addition & 0 deletions backend/app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Creer backend package."""
Loading