Skip to content

feat: add warp init --template scaffolding with async handler templates#130

Merged
tervezo-ai[bot] merged 6 commits intomainfrom
feat/create-async-handler-template-projects-for-rust-go-and-typ-e97krwrforijfo6q050ftykq
Mar 15, 2026
Merged

feat: add warp init --template scaffolding with async handler templates#130
tervezo-ai[bot] merged 6 commits intomainfrom
feat/create-async-handler-template-projects-for-rust-go-and-typ-e97krwrforijfo6q050ftykq

Conversation

@tervezo-ai
Copy link
Copy Markdown
Contributor

@tervezo-ai tervezo-ai bot commented Mar 14, 2026

Summary

Implements warp init --template <name> CLI scaffolding system with three async handler template projects (Rust, Go, TypeScript).

Closes #68

  • Adds warp init --template <name> subcommand that scaffolds a new project from embedded templates
  • Creates async-rust template: #![no_std] WASI component with wit-bindgen, JSON echo/health handler
  • Creates async-go template: TinyGo-based handler using warpgrid-go/http bridge with net/http-style API
  • Creates async-ts template: TypeScript handler using addEventListener("fetch", ...) pattern with full WASI WIT deps
  • Each template includes: source handler, unit tests, warp.toml, README, and WIT definitions
  • Adds parameterized integration tests validating template structure and Rust template compilation/execution

Changes

  • CLI: New init command in crates/warp-cli/src/commands/init.rs with --template and --path flags
  • Templates: Embedded template registry in crates/warp-cli/src/templates/ with scaffolding engine
  • Fixtures: Three template fixture directories under tests/fixtures/ (async-rust-template, async-go-template, async-ts-template)
  • Tests: Integration tests in crates/warpgrid-host/tests/integration_async_templates.rs — structure validation for all 3, build + runtime tests for Rust

Test plan

  • cargo test -p warp-cli — 11 tests pass (init scaffolding, unknown template, target exists)
  • cargo test -p warpgrid-host --test integration_async_templates — 5 pass, 2 ignored (TinyGo/jco not in CI)
  • Rust template builds to valid WASI component and handles health/echo requests
  • Go/TS template structure validated (build tests gated on toolchain availability)

🤖 Generated with Claude Code

nadilas and others added 6 commits March 14, 2026 21:38
Implements Phase 1 of US-509. Adds the `warp init` subcommand with
`--template` and `--path` flags, a template registry with scaffold()
function, and embedded template content for async-rust, async-go, and
async-ts templates. Includes unit tests for scaffolding, error cases,
and file structure validation.

Closes #68

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Creates tests/fixtures/async-rust-template/ with a complete Rust async
handler project that compiles to wasm32-unknown-unknown and produces a
valid WASI component exporting warpgrid:shim/async-handler@0.1.0.

Updates the CLI template embedding to include all 8 WIT files via
include_str!, the panic handler, and the [workspace] opt-out.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Creates tests/fixtures/async-go-template/ with a Go async handler using
the warpgrid-go/http bridge pattern. Includes main.go with health and
echo endpoints, main_test.go with httptest-based unit tests, go.mod,
warp.toml, and README.

Updates CLI async_go.rs template embedding with all fixture files
including test file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Creates tests/fixtures/async-ts-template/ with a TypeScript async handler
using the fetch event pattern. Includes handler.ts, package.json, warp.toml,
README, and the full WASI 0.2.3 + WarpGrid shim WIT deps tree required
by ComponentizeJS.

Updates CLI async_ts.rs template to embed all 37 WIT dep files via
include_str!, ensuring scaffolded projects are self-contained.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Creates integration_async_templates.rs with tests that validate:
- Rust template builds to wasm32, converts to WASI component, exports
  warpgrid:shim/async-handler, loads into WarpGridEngine, and handles
  health + echo requests correctly
- Go template fixture structure validation (TinyGo build test available
  but marked #[ignore] since it requires TinyGo)
- TS template fixture structure validation (jco build test available
  but marked #[ignore] since it requires ComponentizeJS)

5 tests pass, 2 ignored (require external toolchains).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds tests that scaffold each template to a temp directory and verify
the generated files match the corresponding fixture directory content.
This catches drift between embedded templates and test fixtures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tervezo-ai tervezo-ai bot merged commit e0cae78 into main Mar 15, 2026
3 of 10 checks passed
@tervezo-ai tervezo-ai bot deleted the feat/create-async-handler-template-projects-for-rust-go-and-typ-e97krwrforijfo6q050ftykq branch March 15, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

US-509: Create async handler template projects (Rust, Go, TS)

1 participant