feat: add warp init --template scaffolding with async handler templates#130
Merged
tervezo-ai[bot] merged 6 commits intomainfrom Mar 15, 2026
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
warp init --template <name>CLI scaffolding system with three async handler template projects (Rust, Go, TypeScript).Closes #68
warp init --template <name>subcommand that scaffolds a new project from embedded templatesasync-rusttemplate:#![no_std]WASI component with wit-bindgen, JSON echo/health handlerasync-gotemplate: TinyGo-based handler usingwarpgrid-go/httpbridge with net/http-style APIasync-tstemplate: TypeScript handler usingaddEventListener("fetch", ...)pattern with full WASI WIT depsChanges
initcommand incrates/warp-cli/src/commands/init.rswith--templateand--pathflagscrates/warp-cli/src/templates/with scaffolding enginetests/fixtures/(async-rust-template, async-go-template, async-ts-template)crates/warpgrid-host/tests/integration_async_templates.rs— structure validation for all 3, build + runtime tests for RustTest 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)🤖 Generated with Claude Code