|
| 1 | +--- |
| 2 | +title: TypeGPU CLI |
| 3 | +description: Create a TypeGPU project or add TypeGPU to an existing project with npx typegpu@latest. |
| 4 | +--- |
| 5 | + |
| 6 | +import { Tabs, TabItem } from '@astrojs/starlight/components'; |
| 7 | + |
| 8 | +The TypeGPU CLI is the project starter for TypeGPU. |
| 9 | +Use it to scaffold a new TypeGPU project or enhance an existing project with TypeGPU dependencies and setup. |
| 10 | + |
| 11 | +## Creating a project |
| 12 | + |
| 13 | +Run the CLI in the directory where you want to create your project: |
| 14 | + |
| 15 | +<Tabs syncKey="package-manager"> |
| 16 | + <TabItem label="npm" icon="seti:npm"> |
| 17 | + ```sh frame=none |
| 18 | + npx typegpu@latest |
| 19 | + ``` |
| 20 | + </TabItem> |
| 21 | + <TabItem label="pnpm" icon="pnpm"> |
| 22 | + ```sh frame=none |
| 23 | + pnpm dlx typegpu@latest |
| 24 | + ``` |
| 25 | + </TabItem> |
| 26 | + <TabItem label="yarn" icon="seti:yarn"> |
| 27 | + ```sh frame=none |
| 28 | + yarn dlx typegpu@latest |
| 29 | + ``` |
| 30 | + </TabItem> |
| 31 | + <TabItem label="bun" icon="bun"> |
| 32 | + ```sh frame=none |
| 33 | + bunx typegpu@latest |
| 34 | + ``` |
| 35 | + </TabItem> |
| 36 | +</Tabs> |
| 37 | + |
| 38 | +The CLI lets you choose a project name and one of the available templates: |
| 39 | + |
| 40 | +- Vite |
| 41 | +- Vite with a more complete TypeGPU example |
| 42 | +- Vite + React |
| 43 | +- Expo React Native |
| 44 | + |
| 45 | +It can also install dependencies and download the official TypeGPU AI skill during setup. |
| 46 | + |
| 47 | +### Non-interactive creation |
| 48 | + |
| 49 | +Use `--yes` to skip prompts and use defaults: |
| 50 | + |
| 51 | +```sh |
| 52 | +npx typegpu@latest my-app --yes |
| 53 | +``` |
| 54 | + |
| 55 | +You can still select the important setup choices explicitly: |
| 56 | + |
| 57 | +```sh |
| 58 | +npx typegpu@latest my-app --yes --template vite-react --packages @typegpu/sdf --packages @typegpu/noise |
| 59 | +``` |
| 60 | + |
| 61 | +`--yes` skips dependency installation. |
| 62 | +Use `--agent-skills` when you want the TypeGPU AI skill installed during project creation: |
| 63 | + |
| 64 | +```sh |
| 65 | +npx typegpu@latest my-app --yes --agent-skills |
| 66 | +``` |
| 67 | + |
| 68 | +## Enhancing an existing project |
| 69 | + |
| 70 | +Run the CLI with `--enhance` from the root of an existing project: |
| 71 | + |
| 72 | +<Tabs syncKey="package-manager"> |
| 73 | + <TabItem label="npm" icon="seti:npm"> |
| 74 | + ```sh frame=none |
| 75 | + npx typegpu@latest --enhance |
| 76 | + ``` |
| 77 | + </TabItem> |
| 78 | + <TabItem label="pnpm" icon="pnpm"> |
| 79 | + ```sh frame=none |
| 80 | + pnpm dlx typegpu@latest --enhance |
| 81 | + ``` |
| 82 | + </TabItem> |
| 83 | + <TabItem label="yarn" icon="seti:yarn"> |
| 84 | + ```sh frame=none |
| 85 | + yarn dlx typegpu@latest --enhance |
| 86 | + ``` |
| 87 | + </TabItem> |
| 88 | + <TabItem label="bun" icon="bun"> |
| 89 | + ```sh frame=none |
| 90 | + bunx typegpu@latest --enhance |
| 91 | + ``` |
| 92 | + </TabItem> |
| 93 | +</Tabs> |
| 94 | + |
| 95 | +### Non-interactive enhancement |
| 96 | + |
| 97 | +Use `--recommended` with `--yes` to apply the standard Vite-oriented TypeGPU setup without prompts: |
| 98 | + |
| 99 | +```sh |
| 100 | +npx typegpu@latest --enhance --yes --recommended |
| 101 | +``` |
| 102 | + |
| 103 | +You can also add ecosystem packages or the TypeGPU AI skill in the same pass: |
| 104 | + |
| 105 | +```sh |
| 106 | +npx typegpu@latest --enhance --yes --recommended --packages @typegpu/sdf --agent-skills |
| 107 | +``` |
| 108 | + |
| 109 | +If the CLI cannot detect a package manager, pass `--package-manager npm`, `pnpm`, `yarn`, or `bun`. |
| 110 | + |
| 111 | +:::caution |
| 112 | +Back up your project before running the enhance flow. |
| 113 | +The CLI does not provide an automatic rollback. |
| 114 | +::: |
| 115 | + |
| 116 | +## Options |
| 117 | + |
| 118 | +- `-y`, `--yes`: skip prompts and use defaults. |
| 119 | +- `--template <name>`: choose `vite-simple`, `vite-complex`, `vite-react`, or `expo-simple`. |
| 120 | +- `--packages <name>`: add a TypeGPU ecosystem package. Repeat the flag to add more. |
| 121 | +- `--agent-skills`: download the official TypeGPU AI skill. |
| 122 | +- `--package-manager <pm>`: choose the package manager for dependency and skill commands. |
| 123 | +- `--recommended`: use the recommended enhance setup. |
| 124 | + |
| 125 | +## Related tools |
| 126 | + |
| 127 | +If you want to convert existing WGSL shader files into TypeGPU definitions, use [tgpu-gen](/TypeGPU/tooling/tgpu-gen) instead. |
0 commit comments