/canvai-init <project-name>
Create a new design project inside Canvai and launch the dev environment.
Steps
- •
Parse the project name from the user's command (e.g.
/canvai-init button). If no name is provided, ask for one. - •
Check if canvai is installed. Look for
package.jsonin the current directory.- •If no
package.json: runnpm init -y && npm install github:madebynoam/canvai - •If
package.jsonexists but no canvai dependency: runnpm install github:madebynoam/canvai - •If already installed: continue
- •If no
- •
Scaffold the project. Run:
bashnpx canvai init
This creates
index.html,vite.config.ts,src/App.tsx,src/main.tsx, tsconfigs, and installs peer dependencies. It skips files that already exist. - •
Create the project folder:
codesrc/projects/<project-name>/
- •
Launch the dev server in the background:
bashnpx canvai dev
This starts both Vite and the annotation MCP in one command.
- •
Confirm: "Project
<project-name>is ready. Describe a component — I'll generate its variations and states as a matrix on the canvas."
What happens next
After init, the designer describes a component (or attaches a sketch). The agent then:
- •Identifies variations — content scenarios, types, sizes (these become rows)
- •Identifies states — interaction phases, conditions (these become columns)
- •Generates the component — creates
<ComponentName>.tsxin the project folder - •Generates the manifest — creates
manifest.tswith page V1 containing the full matrix of frames - •The canvas auto-discovers the manifest and renders all frames
Manifest format
import { MyComponent } from './MyComponent'
import type { ProjectManifest } from 'canvai/runtime'
const manifest: ProjectManifest = {
project: '<project-name>',
pages: [
{
name: 'V1 — Initial',
grid: { columns: 3, columnWidth: 300, rowHeight: 160, gap: 40 },
frames: [
{ id: '<component>-<variation>-<state>', title: 'Component / Variation / State', component: MyComponent, props: { ... } },
],
},
],
}
export default manifest
Layout rules
- •Columns = states, flowing left to right
- •Rows = variations, flowing top to bottom
- •Frame IDs:
<component>-<variation>-<state> - •Frame titles:
Component / Variation / State - •The grid config in the manifest controls column width, row height, and gap
- •The layout engine computes x/y positions — never set them manually