impr: Add non-interactive mode to CLI#2588
Conversation
|
pkg.pr.new packages benchmark commit |
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:No major changes. 📋 All resultsClick to reveal the results table (355 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
Resolution Time Benchmark---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.88, 1.78, 3.93, 5.42, 7.01, 9.44, 20.18, 24.18]
line [0.83, 1.71, 3.50, 5.82, 6.46, 9.36, 18.82, 22.51]
line [0.86, 1.79, 3.94, 5.54, 6.57, 10.38, 20.14, 22.55]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.32, 0.49, 0.66, 0.77, 1.06, 1.20, 1.43, 1.55]
line [0.30, 0.53, 0.64, 0.75, 1.03, 1.13, 1.35, 1.47]
line [0.32, 0.48, 0.65, 0.80, 1.10, 1.22, 1.40, 1.56]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.84, 1.92, 3.66, 5.88, 11.76, 24.30, 51.77, 105.08]
line [0.88, 1.89, 4.10, 5.81, 11.47, 22.97, 51.81, 102.53]
line [0.71, 1.90, 3.72, 6.72, 11.72, 23.18, 50.95, 105.19]
|
There was a problem hiding this comment.
Pull request overview
Adds a non-interactive (“--yes”) mode and richer CLI options to @typegpu/cli, enabling scripted project creation/enhancement with selectable templates, packages, agent skills, and explicit package manager selection.
Changes:
- Introduces centralized CLI option parsing/validation (
options.ts) and extends CLI entrypoint flags/usage. - Updates create/enhance flows to support non-interactive execution paths (including package selection and agent skills install).
- Refactors “ask” steps into reusable “setup” helpers for non-interactive automation.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/typegpu-cli/src/utils/files.ts | Adds non-interactive directory preparation and supports passing explicit ecosystem packages into scaffolding. |
| packages/typegpu-cli/src/steps/webgpu-types.ts | Extracts non-interactive setupWebgpuTypes helper and reuses it from the prompt-based flow. |
| packages/typegpu-cli/src/steps/vite.ts | Adds non-interactive setupVite helper with optional config creation. |
| packages/typegpu-cli/src/steps/typegpu.ts | Adds non-interactive helpers for installing typegpu and ecosystem packages. |
| packages/typegpu-cli/src/steps/skills.ts | Extracts addAgentSkills helper for non-interactive usage. |
| packages/typegpu-cli/src/options.ts | New module for parsing/validating templates, packages, and package manager flags. |
| packages/typegpu-cli/src/index.ts | Expands CLI args/help and wires parsed options into create/enhance commands. |
| packages/typegpu-cli/src/enhance.ts | Adds non-interactive enhance flow and supports preselected packages/agent skills/package manager. |
| packages/typegpu-cli/src/create.ts | Adds non-interactive create flow (defaults, no prompts) and supports explicit template/packages/skills. |
| packages/typegpu-cli/README.md | Documents new non-interactive usage examples and flags. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f21ef8c to
4bf2be9
Compare
# Conflicts: # packages/typegpu-cli/src/utils/files.ts
|
Could we make |
| if (options?.nonInteractive) { | ||
| await runNonInteractiveEnhance(cwd, pmAgent, pkg, options); | ||
| p.outro('Done! Get ready for a shaderful experience.'); | ||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
Now, this block is fine. In the future, we should add a command line argument for the project kind.
There was a problem hiding this comment.
Perhaps it could be detected automatically?
| if (!pmAgent) { | ||
| failAndExit('Could not detect package manager.'); | ||
| } |
There was a problem hiding this comment.
| if (!pmAgent) { | |
| failAndExit('Could not detect package manager.'); | |
| } |
7f71b99 to
1b5698c
Compare
|
@pullfrog Review this PR please 🙏 |
There was a problem hiding this comment.
Reviewed changes — adds non-interactive/headless mode to the TypeGPU CLI (--yes, --template, --addons, --package-manager flags), refactors step functions into setup* + askFor* pairs, renames templates (-simple → -bare), and adds CLI + AI tools documentation pages.
- Add
options.ts— centralized CLI option types, template/package-manager constants, and validation parsers (parseAddons,parseTemplate,parsePackageManager). - Non-interactive
createProject— acceptsCreateProjectOptions; skips prompts with--yes, supports--project-dir,--template, and--addons. - Non-interactive
enhanceProject— newrunNonInteractiveEnhancepath applies standard Vite-oriented TypeGPU setup without prompts when--enhance --yesis used. - Refactor step files — each step module now exports a
setup*(headless) function and anaskFor*(interactive) function:webgpu-types,vite,typegpu,skills. - Template rename —
template-vite-simple→template-vite-bare,template-expo-simple→template-expo-bare; all references (code, docs, lint config) updated consistently. - Docs — new
typegpu-cli.mdxandai-tools.mdxpages, restructured sidebar with renamed entries, updatedtgpu-gen.mdxto "WGSL to TypeGPU".
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| templateDir, | ||
| root, | ||
| packageName, | ||
| options?.addons.length ? options.addons : nonInteractive ? [] : undefined, |
There was a problem hiding this comment.
options?.addons.length throws TypeError when options is undefined, which the type signature (options?: CreateProjectOptions) permits. The ?. chain stops at options, so undefined.length is evaluated.
Technical details
# `options?.addons.length` TypeError when options is undefined
## Affected sites
- `packages/typegpu-cli/src/create.ts:84` — `options?.addons.length ? options.addons : ...`
## Required outcome
- No TypeError when calling `createProject(cwd)` without an options object.
## Suggested approach
Change to `options?.addons?.length`. The rest of the ternary logic remains correct.| if (!(await ensureTypegpu(pm, pkg))) { | ||
| return; | ||
|
|
||
| if (options?.addons.length) { |
There was a problem hiding this comment.
Same latent options?.addons.length TypeError as in create.ts:84. While the current call site at line 93 always passes options, the function signature (options?: EnhanceProjectOptions) invites the same bug if called directly.

closes #2585
closes #2586