From 95ba58f23a5d84e0b902681302569cb8e610912d Mon Sep 17 00:00:00 2001 From: Alex Kroman Date: Thu, 4 Jun 2026 14:57:49 -0700 Subject: [PATCH 01/32] docs: design spec for aai init scaffolder Vercel-style interactive scaffolder: pick from 4 templates (transcribe, stream, agent, llm), copy a real Vercel-deployable Python web project, install deps, launch a local server, and open the browser. stream and agent both connect the browser directly to AssemblyAI via temp tokens; transcribe and llm use a thin upload/poll backend. Generated files kept deliberately flat/simple for human + Claude Code iteration. Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitignore | 3 + specs/2026-06-04-aai-init-design.md | 229 ++++++++++++++++++++++++++++ 2 files changed, 232 insertions(+) create mode 100644 specs/2026-06-04-aai-init-design.md diff --git a/.gitignore b/.gitignore index caa963c5..fd4feafd 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,6 @@ transcribe/ # Wrong tool for this project (hatchling + uv); never commit a poetry lock poetry.lock + +# Brainstorming visual-companion scratch +.superpowers/ diff --git a/specs/2026-06-04-aai-init-design.md b/specs/2026-06-04-aai-init-design.md new file mode 100644 index 00000000..83cafbb6 --- /dev/null +++ b/specs/2026-06-04-aai-init-design.md @@ -0,0 +1,229 @@ +# `aai init` — interactive project scaffolder + +**Status:** Approved (design) +**Date:** 2026-06-04 + +## Summary + +Add an `aai init` command: a Vercel-style scaffolder that lets a user pick from +four templates, then **copies a real, runnable Python web project**, installs its +dependencies, starts a local server, and opens the browser — so the user can +interact with an AssemblyAI capability immediately and then keep building. + +The generated project's prime directive: **the files must be as simple as +possible** so a human (or Claude Code) can read and extend them right after +creation. No build step, no framework magic — two files carry the real logic. + +## Goals + +- One command (`aai init`) takes a user from nothing to a running, browser-based + AssemblyAI demo. +- Four templates covering the CLI's core capabilities: `transcribe`, `stream`, + `agent`, `llm`. +- Generated code is flat, plain, and immediately editable. +- The browser **never** receives the real API key. +- Each template is **structured so Vercel can deploy it as-is** (static frontend + + a thin stateless backend). We add the conventional layout + a `vercel.json`, but + build **no** deploy tooling of our own (no Dockerfiles, deploy buttons, or + Cloudflare functions) — that would only overlap with what Vercel already does. + +## Non-goals + +- Replacing `aai samples create` (it coexists — see below). +- A Node/JavaScript toolchain. Templates are Python backend + a single vanilla + HTML/JS page. +- A reusable framework or component library. Each template is self-contained. + +## Relationship to existing commands + +- **`aai samples create`** stays as-is: the quick **single-script** scaffolder + (one `.py` file, terminal output, no browser). `aai init` is the **full + interactive project + browser** experience. Clear split: *samples = snippet, + init = app.* +- Template `api/index.py` logic is kept consistent with `aai_cli/code_gen`'s + generators (same AssemblyAI call patterns), verified by a test. `code_gen` + remains the reference; templates are committed real files (Approach A below). + +## Architecture decision: ship real template projects (Approach A) + +The four templates live as **actual, committed, runnable project directories** +inside the package (`aai_cli/init/templates//`). `aai init` *copies* the +chosen one rather than rendering it from string templates. + +- The generated output **is** the files we hand-wrote and tested — no + template-rendering indirection between what we verify and what the user gets. + This is the simplest possible output, which is the core constraint. +- Templates are runnable in-repo, so they are easy to test and dogfood. +- Trade-off: some AssemblyAI call logic overlaps with `code_gen`. We keep them + honest with a smoke test that loads each template and an optional + reference-consistency check. + +(Rejected: generating everything from `code_gen` + a web shell. String +templating produces more abstract/indirected code — the opposite of the +"simple files Claude can improve" goal.) + +## Command surface + +``` +aai init [TEMPLATE] [DIRECTORY] [options] +``` + +- **No args** → arrow-key picker (`questionary`) for the template, then a prompt + for the directory (default `./