Connect a Repository
Enable Stitch workspace features, connect your local codebase or GitHub repository, and link a Stitch Canvas project.
Generating individual screens is great for starting something new. When you want Stitch to understand an existing application—its routes, navigation, and component structure—connect your repository to a Stitch Workspace.
Once connected, Stitch can inspect your real routes, evaluate them against your product priorities, and generate UI prototypes grounded in your actual codebase.
Enable workspace features
Out of the box, the @google/stitch CLI keeps things focused on Canvas and DESIGN.md commands. Enable workspace features once on your machine with stitch enable loop:
stitch enable loop
Running stitch enable loop unlocks all workspace commands (workspace, priority, insight, solution, context, upload code, upload file, connect, github) and automatically updates any installed /stitch skills (.agents/skills/stitch/) to include the codebase onboarding playbook.
If you ever want to turn workspace commands back off, run stitch disable loop.
Onboard your repository with the /stitch skill
The easiest way to connect a repository is to let the /stitch skill walk you through it. Make sure the skill is installed (stitch agent-skills add), then invoke /stitch inside your repository:
Your coding agent checks your sign-in status, helps you pick or create a workspace, uploads your codebase snapshot, captures your live application routes from your local dev server, and links your Stitch Canvas project—pausing only when it needs your approval on which workspace or routes to use.
Connect from the terminal
If you prefer to run the setup commands yourself, follow three steps: pick a workspace, give Stitch access to your code, and link a Canvas project.
Create and pin a workspace
A workspace holds your codebase snapshots, priorities, context files, insights, and proposed solutions. List your existing workspaces or create a new one, then pin it to your repository:
stitch find workspaces --limit 10
stitch create workspace --title "Acme Web App"
stitch config set workspace <workspace-id>
Pinning the workspace saves it to .stitch.json so you don’t have to pass --workspace on every command.
Upload your codebase or connect GitHub
Next, give your workspace access to your source code. The fastest path is uploading your git-tracked working tree directly from your terminal—no GitHub App installation required:
stitch upload code .
If you want Stitch to stay synced with a GitHub repository or open pull requests automatically, you can also connect GitHub directly:
stitch github login
stitch github repos
stitch edit workspace <workspace-id> --add-repo https://github.com/<owner>/<repo>
Link your Stitch Canvas project
Finally, bind your Stitch Canvas project to your workspace so captured routes and generated prototypes land on the right canvas:
stitch loop link --project <project-id>
Connect external tools
If your team keeps product context in external tools, you can browse the integration catalog and attach connections or webhooks to your workspace:
stitch connect --list
stitch connect <catalog-id>
stitch find connections
Original: https://stitch.withgoogle.com/docs/cli/workspaces-and-projects/
Translated from the official Google Stitch documentation. Original content © Google LLC. This is an independent, unofficial translation.